proxybuy-flutter/HUNT_CARD_LAYOUT_FIX.md

2.4 KiB

Hunt Card Layout Fix Summary

🔧 Layout Overflow Issue Fixed

Problem:

  • RenderFlex overflowed by 60 pixels on the bottom in hunt card widget
  • Issue occurred in the back side of the card (flipped state) at line 206
  • Content was too tall for the fixed 180px card height

Root Cause:

The back side of hunt cards contained:

  1. Header row (Mystery Quest + Timer badge)
  2. SizedBox(height: 12)
  3. Expanded question container with padding
  4. SizedBox(height: 12)
  5. Bottom points banner
  6. Total content exceeded 180px height

Solution Applied:

1. Increased Default Card Height

// Before: height: widget.customHeight ?? 180
// After:  height: widget.customHeight ?? 200
  • Added 20px extra height for better content fit

2. Reduced Spacing

// Before: SizedBox(height: 12) x2 = 24px total
// After:  SizedBox(height: 8) x2 = 16px total
  • Saved 8px in vertical spacing

3. Optimized Text Container Padding

// Before: padding: EdgeInsets.all(12)
// After:  padding: EdgeInsets.all(10)
  • Reduced inner padding by 4px total

4. Reduced Font Sizes

// Header title: 18 → 16 (-2px)
// Question text: 14 → 13 (-1px)  
// Bottom banner: 12 → 11 (-1px)
// Line height: 1.4 → 1.3 (tighter)

5. Optimized Bottom Banner

// Before: padding: EdgeInsets.symmetric(vertical: 8)
// After:  padding: EdgeInsets.symmetric(vertical: 6)
  • Reduced vertical padding by 4px total

Total Space Saved:

  • +20px from increased card height
  • -8px from reduced spacing
  • -4px from container padding
  • -4px from banner padding
  • ~6px from smaller fonts and line height
  • Total improvement: ~38px - well within the 60px overflow

Current Card Heights:

  • Default cards: 200px (was 180px)
  • Selected card: 220px (unchanged - already sufficient)
  • Custom cards: Uses customHeight parameter

Benefits:

No more overflow errors
Better content readability
Maintains visual hierarchy
Preserves animations and interactions
Responsive to different content lengths

Testing:

  • All hunt cards now fit properly within their containers
  • No rendering overflow warnings
  • Animations and flip effects work smoothly
  • Text remains readable and well-spaced
  • Compatible with both light and dark themes

The hunt card layout is now fully optimized and overflow-free! 🎯