Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

A Flutter Column does not expand to fill the screen

ErrorThe Column and its children are narrow and centered

Short answer

A Column is as tall as its incoming constraints by default but only as wide as its widest child, and it does not stretch children for you. Set crossAxisAlignment to stretch for width, wrap a child in Expanded for height, and never put Expanded in a Column inside a ListView, which has unbounded height.

  • Applies to Flutter 3.35, Dart 3.9
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Turn on the Flutter inspector's layout explorer, or wrap the Column in a colored Container, to see how much space it really takes.

    Container(color: Colors.amber, child: Column(children: [/* ... */]))
  2. 2Match what you see, then jump to its fix

    1. 1Everything is narrow and centered horizontallyWidth follows the widest childFix
    2. 2The Column fills the screen but a child stays smallA child needs Expanded to take the remaining heightFix
    3. 3Exception: children with non-zero flex but the vertical constraints are unboundedThe Column sits in a ListView or other unbounded parentFix

What does the error look like?

  • The Column and its children are narrow and centered
  • There are children with non-zero flex but the vertical constraints are unbounded

Cause 1 of 3

Width follows the widest child

1Check

The width of a Column is the maximum width of its children, and crossAxisAlignment defaults to center.

grep -rn "Column(" lib/

2Fix

Set crossAxisAlignment to stretch, which gives children tight horizontal constraints equal to the incoming maximum width.

Column(
  crossAxisAlignment: CrossAxisAlignment.stretch,
  children: [Text('Title'), ElevatedButton(onPressed: () {}, child: Text('Go'))],
)

3Verify

The children now span the full width.

flutter run

Confirmed by api.flutter.dev

Did this fix it?

Cause 2 of 3

A child needs Expanded to take the remaining height

1Check

A Column with mainAxisSize max takes the full incoming height, but children keep their own height unless wrapped in Expanded.

grep -rn "Expanded" lib/

2Fix

Wrap the child that should grow in Expanded. The layout docs say Expanded ignores the child's own preferred size.

Column(
  children: [
    Text('Header'),
    Expanded(child: Container(color: Colors.blue)),
  ],
)

3Verify

The blue box fills everything under the header.

flutter run

Confirmed by docs.flutter.dev

Did this fix it?

Cause 3 of 3

The Column sits in a ListView or other unbounded parent

1Check

A vertical scrollable provides infinite height, so Expanded and Flexible cannot work inside it.

grep -rn "ListView\|SingleChildScrollView" lib/

2Fix

Remove Expanded or Flexible from the inner children, give the Column a fixed-height parent, or move the Column outside the scrollable.

SizedBox(
  height: 400,
  child: Column(children: [Expanded(child: Placeholder())]),
)

3Verify

The exception is gone.

flutter run

Confirmed by api.flutter.dev

Did this fix it?

How do I stop it coming back?

  • Remember the rule: constraints go down, sizes go up, the parent sets the position.
  • Be specific about alignment instead of hoping a child fills its parent.
  • Use the layout explorer while building a screen.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.