Flutter Layout & Scrolling Widgets: A Practical Introduction
By Dhrumil Patel · Published · Updated · 5 min read

Flutter's layout system is powerful but can be confusing when you first encounter constraints, unbounded heights, and scrolling widgets that refuse to size themselves. This guide breaks down the core layout widgets and scrollable containers you'll use daily, with concrete examples and numbers you can apply immediately.
We'll cover Row, Column, Stack, and the scrolling families: ListView, GridView, and CustomScrollView. You'll see how constraints flow, why some widgets need bounded space, and how to keep scrolling smooth with realistic performance targets.
How Flutter Layout Works: Constraints Flow Down, Sizes Flow Up
Every Flutter layout starts with a parent passing constraints to its child. A constraint is a min and max width and height. The child picks a size within those bounds and reports it back. This single rule explains most layout errors: if a child receives unbounded height (maxHeight = infinity), widgets like Expanded or ListView will throw because they need finite space to compute their size.
When you nest a Column inside a SingleChildScrollView, the Column gets unbounded height and tries to size to its children. That's fine until you add Expanded or a ListView inside the Column—then you must give those children a bounded height, typically via SizedBox or by restructuring the tree. Understanding this flow prevents hours of debugging.
The RenderBox tree is built top-down, and each widget only knows its parent's constraints. Use the LayoutBuilder widget to read incoming constraints and adapt your UI—for example, switching from a Row to a Column when maxWidth drops below 600 logical pixels. This is the foundation of responsive design in Flutter.
- Constraints are min/max width and height passed from parent to child.
- Children choose a size within those constraints and report it back.
- Unbounded height (infinity) breaks widgets that need finite space.
- LayoutBuilder exposes incoming constraints for adaptive layouts.
Row, Column, and Flex: Aligning and Distributing Space
Row and Column are Flex widgets that lay out children along one axis. Their mainAxisAlignment controls distribution along that axis, while crossAxisAlignment controls alignment on the perpendicular axis. With mainAxisSize.min, a Row shrinks to fit its children; with .max (default), it expands to fill the available main-axis space. This matters when you place a Row inside a Column—the Row will try to take all vertical space unless constrained.
Expanded and Flexible let children share the main-axis space. Expanded forces a child to fill the available space (flex factor 1 by default), while Flexible allows it to be smaller. A common pattern is Row(children: [Expanded(child: Text(...)), Icon(...)]) to let text take remaining space. Overusing Expanded can cause overflow if children have minimum sizes larger than their share.
For precise control, use Spacer (an Expanded with an empty child) to push siblings apart, or MainAxisAlignment.spaceBetween for even distribution. Keep in mind that Row and Column do not scroll; if content exceeds the screen, you'll get a yellow-and-black overflow warning. Wrap in SingleChildScrollView or switch to a scrollable list.
- mainAxisSize.min shrinks a Row/Column to fit children; .max expands to fill.
- Expanded fills available space; Flexible allows a child to be smaller.
- Use Spacer to push siblings apart without hardcoding gaps.
- Row/Column don't scroll; overflow warnings appear when content exceeds bounds.
| Widget | Lazy Loading | Best For | Performance Consideration |
|---|---|---|---|
| ListView (default) | No | Short lists (<20 items) | Builds all children at once; fine for small lists |
| ListView.builder | Yes | Long lists, dynamic content | Lazy; keep item builders cheap |
| GridView.builder | Yes | Grids of images or cards | Use maxCrossAxisExtent for responsiveness |
| SingleChildScrollView | No | Forms, detail pages | Builds entire child; avoid for long content |
| CustomScrollView | Yes (slivers) | Mixed content, collapsing headers | Most flexible; requires sliver knowledge |
Stack and Positioned: Overlapping Widgets
Stack layers children on top of each other, with the first child at the bottom. Use Positioned to place a child at specific offsets from the Stack's edges. If you omit Positioned, the child is aligned according to the Stack's alignment property (topStart by default). Stack sizes itself to its largest non-positioned child, unless you give it explicit dimensions or fit: StackFit.expand.
A typical use case is a badge over an icon: Stack(children: [Icon(...), Positioned(right: 0, top: 0, child: Badge(...))]). Be careful with Positioned children that have unbounded dimensions—they won't affect the Stack's size. If you need the Stack to fill the screen, wrap it in a SizedBox.expand or set fit: StackFit.expand.
For performance, keep the number of Stack children small (under 10 is a good rule of thumb) and avoid expensive widgets like BackdropFilter inside frequently rebuilt Stacks. If you need complex overlapping layouts, consider CustomMultiChildLayout for more control, but Stack covers most UI needs.
- Stack layers children; first child is at the bottom.
- Positioned places a child at specific offsets from Stack edges.
- Stack sizes to its largest non-positioned child unless constrained.
- Keep Stack children count modest for better rebuild performance.
ListView and GridView: Building Scrollable Lists
ListView is the go-to for vertical scrolling lists. The default constructor builds all children at once, which is fine for short lists (say, under 20 items). For longer lists, use ListView.builder, which lazily creates children as they scroll into view. This keeps memory usage low and frame times stable—aim for 16ms per frame to hit 60fps, or 8ms for 120Hz displays.
GridView works similarly but arranges items in a grid. Use GridView.builder with SliverGridDelegateWithFixedCrossAxisCount for a fixed number of columns, or SliverGridDelegateWithMaxCrossAxisExtent to let columns adapt to screen width. A common pitfall is nesting a ListView inside a Column without a bounded height—wrap it in Expanded or give it a fixed height.
For mixed content (headers, grids, lists), CustomScrollView with slivers gives you fine control. SliverList and SliverGrid are lazy, and SliverAppBar enables collapsing headers. If you're comparing these options, see Scrolling Widgets Compared: ListView, GridView and CustomScrollView for a detailed breakdown.
- Use ListView.builder for lists longer than ~20 items to enable lazy loading.
- GridView.builder with maxCrossAxisExtent adapts columns to screen width.
- Nested scrollables need bounded height (use Expanded or SizedBox).
- CustomScrollView + slivers handle mixed content and collapsing headers.
SingleChildScrollView and CustomScrollView: When to Use Each
SingleChildScrollView makes a single child scrollable. It's perfect for forms or detail pages where content might overflow, but it builds the entire child at once—so avoid it for long lists. It also doesn't support lazy loading. If you have a Column with many widgets, SingleChildScrollView will render all of them, which can hurt performance if the list grows beyond a few dozen items.
CustomScrollView is the powerhouse for complex scrolling effects. It takes a list of slivers, each of which can be a SliverList, SliverGrid, SliverToBoxAdapter (for a single box widget), or SliverAppBar. Because slivers are lazy, CustomScrollView scales well. Use it when you need a collapsing app bar, a sticky header, or a mix of grid and list sections.
A practical rule: if your screen is a simple scrollable column of widgets, SingleChildScrollView is fine. If you need lazy loading, sticky headers, or multiple scrollable sections, reach for CustomScrollView. For animation timing in scroll effects, Flutter Animation Controllers Explained With Timing Numbers covers the numbers you need.
- SingleChildScrollView builds all content at once—avoid for long lists.
- CustomScrollView uses slivers for lazy loading and advanced effects.
- SliverAppBar enables collapsing headers and sticky toolbars.
- Choose based on content length and need for lazy loading.
Performance and Responsive Design Tips
Scrolling performance hinges on keeping build and layout times under the frame budget. On a 60Hz device, you have 16ms per frame; at 120Hz, just 8ms. Lazy lists help, but expensive widgets in item builders (like large images without caching) can still cause jank. Use const constructors, avoid rebuilding entire lists, and cache images with a package like cached_network_image.
For responsive layouts, use MediaQuery to read screen size and orientation, and LayoutBuilder for parent constraints. Breakpoints like 600dp for tablets and 840dp for larger screens are common. Instead of hardcoding widths, use Flexible, Expanded, and fractional sizing. Test on multiple emulators or devices—Flutter's hot reload makes iterating fast.
Memory matters too: a ListView with thousands of items won't load all at once if you use .builder, but each item's state can add up. Keep item widgets lightweight and dispose controllers properly. If you're building a Flutter app and budgeting, What Does a Flutter App Cost to Build in 2026? gives realistic ranges.
- Target 16ms per frame for 60fps; 8ms for 120Hz.
- Use const widgets and avoid unnecessary rebuilds in list items.
- MediaQuery and LayoutBuilder enable responsive breakpoints.
- Keep list item widgets lightweight and dispose controllers.
- Constraints flow down and sizes flow up—understanding this prevents most layout errors.
- Use ListView.builder or CustomScrollView for long lists to stay within the 16ms frame budget.
- Row and Column don't scroll; wrap in SingleChildScrollView or use a scrollable list for overflow.
- Responsive design starts with MediaQuery and LayoutBuilder, not hardcoded dimensions.
Writes practical Flutter tutorials focused on widgets, layout and animation. Enjoys breaking large UI problems into small, testable pieces and explaining them clearly to beginners.


