Flexible and Expanded are layout widgets used inside Row, Column, and Flex. They control how a child widget uses available space along the main axis (horizontal in Row, vertical in Column). Expanded is a specific case of Flexible, so understanding Flexible first helps avoid most layout mistakes.
Both widgets tell a Flex parent how to distribute free space among its children.
FlexFit.loose.FlexFit.tight.A good mental model is: Flexible says “you may grow”, Expanded says “you must grow”.
Choosing between Flexible and Expanded directly affects:
Many "RenderFlex overflowed" errors come from using Expanded where Flexible would be safer.
The visual impact is important:
Flexible lets a widget keep its natural sizeExpanded pushes siblings apart by filling spaceThis difference explains why icons sometimes "stick" next to text instead of aligning to the screen edge.
Use Flexible when the child widget has an intrinsic size that should influence layout, such as text, buttons, or icons. Flexible is ideal when content varies in length and you want the layout to adapt dynamically without causing overflow errors.
Flexible allows the child to shrink or grow, but by default (FlexFit.loose) it lets the child be smaller than the allocated space if its content doesn’t need it.Flexible works well when you want to prioritize responsiveness over strict filling, letting widgets take only as much space as they need while sharing leftover space fairly with siblings.Using Flexible properly reduces layout issues and ensures that dynamic content doesn’t break the UI on different screen sizes or orientations.
Use Expanded when a widget must fill all remaining space in a Row, Column, or Flex container. Expanded enforces a stricter layout behavior than Flexible, making it ideal when you need uniform sizing or full coverage of available space.
Expanded is a shorthand for Flexible(fit: FlexFit.tight). It forces the child to expand and fill every pixel of the available space, even if the child’s content is smaller.Expanded is commonly used in dashboards, grids, or split layouts, where equal distribution of space across multiple widgets is required.In short, Flexible adapts to content size (loose), while Expanded enforces full usage of remaining space (tight). Understanding the difference between FlexFit.loose and FlexFit.tight clarifies how both widgets share space in a Row, Column, or Flex.
Some issues appear very often:
Expanded in the scroll direction of a ListView.Expanded inside a vertical ListView)Expanded to "fix" overflow.Expanded outside Row, Column, or Flex.Important clarification: Using Expanded perpendicular to scrolling is perfectly valid.
For example, a horizontal Expanded inside a Row that sits in a vertical ListView works as expected.
Expanded only fails when it tries to expand into an unbounded (infinite) dimension.
To keep layouts predictable:
Flexible, upgrade to Expanded only when needed.flex values intentionally.Sometimes you don’t need either:
Spacer for empty flexible space.SizedBox for fixed dimensions.Align or Padding for positioning.15 min. • Jun 6, 2023
Flutter is known for its seamless UI/UX features and robust design elements. It allowed us to deliver a unique customer experience in the “CA24 Mobile” banking app. This article shares some of the learnings and pain points behind implementing it in this large project.
9 min. • Jun 1, 2023
Building a new digital product, such as a web or mobile application, is complex. You need to map user stories - create a simple description of features - then apply them to the developers' scope of work and the app’s design. Discover how a design system can unleash efficiency, consistency, and scalability in your digital product.