Short answer
Read the message: a line such as The offending Expanded is currently placed inside a Padding widget names the wrapper to move, and Typically, Expanded widgets are placed directly inside Flex widgets names the parent it needs. Make the Expanded, Flexible or Positioned the direct child of its Row, Column or Stack, and move any Padding or Container inside it instead of around it. Remove an Expanded that sits in a ListView, Wrap or Stack; those parents don’t use it.
Where the widget ended up, and the fix
01
A Padding or Container around an Expanded
“the path from the Expanded widget to its enclosing Row, Column, or Flex must contain only StatelessWidgets or StatefulWidgets” Flutter, Expanded class
Padding, Container, Center, Opacity, Visibility and AnimatedOpacity sit between the Row and the Expanded, so the Expanded isn’t the Row’s child any more. Swap them: Expanded on the outside, the wrapper inside. A Builder, a Consumer or your own StatelessWidget in between is fine.
// breaks: Padding sits between Row and Expanded Row(children: [ Padding( padding: const EdgeInsets.all(8), child: Expanded(child: Text(title)), ), ]) // works: Expanded is the Row's direct child Row(children: [ Expanded( child: Padding( padding: const EdgeInsets.all(8), child: Text(title), ), ), ])02
An Expanded in a parent that isn’t a Row or Column
“While Flutter's widgets are generally flexible in how they can be composed together in a UI, a small subset of those widgets expect specific parent widgets.” Flutter, Common Flutter errors
An Expanded inside a ListView, Stack, Wrap or SizedBox has no flex layout to take part in. In a ListView, give the child a height instead; in a Stack, use Positioned or Align.
03
A Positioned outside a Stack
“A Positioned widget must be a descendant of a Stack” Flutter, Positioned class
Positioned only works under a Stack, with the same rule about wrappers in between. Anywhere else, use Align or Padding to place the widget.
04
A reusable widget that returns Expanded
“Usually, this indicates that at least one of the offending ParentDataWidgets listed above is not placed directly inside a compatible ancestor widget.” Flutter, Common Flutter errors
A custom widget whose build returns an Expanded works only where its caller puts it straight into a Row or Column. Move the Expanded out to the caller, so the widget can be used anywhere.
Checked against the vendor’s docs on : Flutter: Common Flutter errors (Incorrect use of ParentData widget); Flutter API: Expanded class; Flutter API: Positioned class.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.See scope and start
Related: Flutter “A RenderFlex overflowed” · Flutter “RenderBox was not laid out” · Flutter “setState() called during build” · Flutter “type 'Null' is not a subtype of type 'String'”