Skip to content

Fix: RenderFlex overflow (45px) in home_screen.dart Column widget #43

Description

@coderabbitai

Bug Report: RenderFlex Overflow in home_screen.dart

Description

A RenderFlex overflow exception is thrown during layout in the home screen. The Column widget at lib/screens/home_screen.dart line 500:16 overflows by 45 pixels on the bottom.

Error Message

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞══════════════════
The following assertion was thrown during layout:
A RenderFlex overflowed by 45 pixels on the bottom.

The relevant error-causing widget was:
  Column
  Column:file:///...workout-logger/lib/screens/home_screen.dart:500:16

Widget Tree (from error log)

Column ← Padding ← Container ← NotificationListener<DraggableScrollableNotification> ←
  DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures ←
  NotificationListener<LayoutChangedNotification> ← CustomPaint ← _ShapeBorderPaint ←
  PhysicalShape ← _MaterialInterior ← ⋯

RenderFlex Details

Property Value
Direction Vertical (Axis.vertical)
mainAxisAlignment start
mainAxisSize min
crossAxisAlignment start
Constraints BoxConstraints(0.0<=w<=363.4, 0.0<=h<=439.9)
Size Size(363.4, 439.9)
Overflow 45 pixels on the bottom

Root Cause

The Column widget uses mainAxisSize: min, meaning it tries to size itself to its children's natural size. When the children are too tall for the available space (height constraint of 439.9px), the column overflows.

Suggested Fixes

  1. Wrap children with Expanded or Flexible — to allow children to flex within the available space.
  2. Replace Column with a ListView or SingleChildScrollView + Column — to make the content scrollable when it exceeds the available height.
  3. Wrap the Column in a SingleChildScrollView:
    SingleChildScrollView(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [...],
      ),
    )
  4. Use ClipRect — if clipping is acceptable for the use case.

Steps to Reproduce

  1. Launch the app and navigate to the home screen.
  2. Observe the yellow-and-black striped overflow pattern at the bottom of the widget.
  3. Check the debug console for the RenderFlex overflow exception.

References

Assignee

@Devasy

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions