A Flutter Row or Column shows yellow and black stripes and says it overflowed
A RenderFlex overflowed by 143 pixels on the right.Short answer
A RenderFlex is a Row or Column. It overflows when a child asks for more space than the Row or Column can give. Find the widget named in the error, then wrap the greedy child in Expanded or Flexible, let a tall Column scroll, or use Wrap so children move to the next line.
Fix it fast
1Find out which cause you have
Read the first lines of the error in the debug console. It names the Row or Column and the file and line, and says whether the overflow is horizontal or vertical. That tells you which cause below applies.
flutter run -d chrome # or any device; read the 'relevant error-causing widget' lines in the console2Match what you see, then jump to its fix
- 1
Axis.horizontal, and the stripes are on the right edgeA child of a Row is wider than the space left (long Text, Column or image)Fix - 2
Axis.vertical, and the stripes are on the bottom edgeA Column is taller than the screen (small phone, keyboard open, landscape)Fix - 3
Axis.horizontal with several small siblings of fixed widthA row of chips, tags or buttons that should flow onto the next lineFix
- 1
What does the error look like?
A RenderFlex overflowed by 143 pixels on the right.The overflowing RenderFlex has an orientation of Axis.horizontal.A yellow and black striped pattern on the edge of the screen
Cause 1 of 3
A child of a Row is wider than the space left (long Text, Column or image)
1Check
A Row does not limit the width of its children. A Text with a long string, or a Column holding such a Text, takes the width of the whole string and pushes past the edge.
// Look for a Row whose child is not wrapped in Expanded or Flexible
Row(children: [
Icon(Icons.message),
Column(children: [Text('a very long title'), Text('a very long body ...')]),
])2Fix
Wrap the greedy child in Expanded so it gets only the width that is left. Flexible does the same and lets the child be smaller than that space.
Row(children: [
const Icon(Icons.message),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [Text('a very long title'), Text('a very long body ...')],
),
),
])3Verify
Hot reload. The stripes are gone and the long text now wraps inside the space it has.
# press r in the flutter run terminalConfirmed by docs.flutter.dev
Cause 2 of 3
A Column is taller than the screen (small phone, keyboard open, landscape)
1Check
A Column with fixed or tall children does not scroll by itself. When the screen gets shorter than the content, the extra height has nowhere to go.
flutter run # rotate the device, or open the keyboard, and watch whether the stripes appear2Fix
Put the Column inside a SingleChildScrollView so it scrolls when the space is too small. Do not use Expanded or Flexible inside a Column that sits in a scroll view: the available space there is infinite.
SingleChildScrollView(
child: Column(
children: const [Text('header'), SizedBox(height: 400), Text('footer')],
),
)3Verify
Rotate the device or open the keyboard again: the page scrolls and no stripes show.
# repeat the step that caused the overflowConfirmed by api.flutter.dev
Cause 3 of 3
A row of chips, tags or buttons that should flow onto the next line
1Check
A Row puts every child in one line, however many there are. If the number of items changes at run time, a fixed line will overflow sooner or later.
// Look for Row(children: items.map(...).toList()) with a variable number of items
grep -rn "Row(" lib/2Fix
Use Wrap. It starts a new run when the line is full. Set spacing for the gap inside a run and runSpacing for the gap between runs.
Wrap(
spacing: 8,
runSpacing: 8,
children: tags.map((t) => Chip(label: Text(t))).toList(),
)3Verify
Add more items than fit on one line. They continue on a second line.
# hot reload and add itemsConfirmed by api.flutter.dev
How do I stop it coming back?
- Wrap any Text that sits next to other widgets in a Row with Expanded or Flexible from the start.
- Test every screen once on a small phone size, in landscape and with the keyboard open.
- Use ListView instead of a long Column when the number of items is not fixed.
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- Qist BazaarA buy-now-pay-later marketplace built from a blank repo, now past 100K downloads on Google Play.
- SessionBirdAn omnichannel engagement suite in Flutter: campaigns, chatbot, tickets, analytics and live calling.
Related fixes
Mobile apps
AudioCache has no play method after updating audioplayers
The method 'play' isn't defined for the type 'AudioCache'.
Since audioplayers 1.0, AudioCache only turns asset files into local files and caches them.
2 causes, each with a fixMobile apps
Flutter Bloc throws that emit was called after the event handler completed
emit was called after an event handler completed normally.
Each on<Event> handler gets its own Emitter, and it stops working the moment the handler's returned Future completes.
2 causes, each with a fixMobile apps
analysis_options.yaml: the URI it includes can't be found
include_file_not_found
The analyzer reports include_file_not_found when the file named after include: in analysis_options.yaml does not resolve.
2 causes, each with a fixMobile apps
Dart error: the body might complete normally and return null for a non-nullable type
body_might_complete_normally
Dart found a path through your function or callback that reaches the closing brace without a return.
3 causes, each with a fixMobile apps
Dart throws ConcurrentModificationError while looping over a list
ConcurrentModificationError
Dart throws this when a collection changes size while something iterates it.
2 causes, each with a fixMobile apps
Dart cannot turn a compact timestamp like 20201101153000 into a DateTime
FormatException: Invalid date format
DateTime.parse accepts a subset of ISO 8601, and a time part must be introduced by T or a space.
2 causes, each with a fix