How do you fix "A RenderFlex overflowed by pixels" in Flutter?

← Flutter answers

A Row or Column received children larger than the space available. Wrap flexible children in Expanded or Flexible, or put the content in a scroll view.

// Overflows when the title is long
Row(children: [Icon(Icons.info), Text(longTitle)]);
 
// Fix 1: let the text take the remaining width and wrap or ellipsize
Row(children: [
  Icon(Icons.info),
  Expanded(child: Text(longTitle, overflow: TextOverflow.ellipsis)),
]);
 
// Fix 2: vertical overflow, usually when the keyboard opens
SingleChildScrollView(child: Column(children: fields));

The yellow and black stripes in debug builds show the edge that overflowed. Expanded fills the free space, Flexible allows a child to be smaller than that space, and a scroll view removes the limit entirely. Check the parent's constraints in the Flutter Inspector if the cause is not obvious.

Related questions

Start debugging smarter today

Try Bugsee for free — no commitments, no hidden fees.

Free sign upLive demoNo credit card required