Flutter ListView vs GridView: Choosing and Building Scrollable Layouts

ListView and GridView are both scrollable layout widgets built on the same underlying machinery, and share most of their constructors and performance characteristics. The difference is purely about arrangement: one column versus a grid.

Quick Comparison

AspectListViewGridView
LayoutSingle column or rowRows and columns (grid)
Builder constructorListView.builderGridView.builder
Needs a delegateNoYes, gridDelegate
Best forFeeds, chat, settings, search resultsPhoto galleries, product catalogs, icon pickers
Lazy renderingYes, with .builderYes, with .builder

ListView: One Item After Another

ListView.builder(
  itemCount: messages.length,
  itemBuilder: (context, index) {
    return ListTile(title: Text(messages[index].text));
  },
)

Use ListView.builder (not the plain ListView(children: [...]) constructor) for anything beyond a handful of items — it only builds the widgets currently visible on screen, rather than every item up front, which matters a lot for a list with hundreds or thousands of entries.

GridView: A Fixed Number of Columns

GridView.builder(
  gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
    crossAxisCount: 2,
    mainAxisSpacing: 8,
    crossAxisSpacing: 8,
  ),
  itemCount: products.length,
  itemBuilder: (context, index) {
    return ProductCard(product: products[index]);
  },
)

The gridDelegate is what makes GridView different from ListView — it decides how items are arranged into rows and columns. SliverGridDelegateWithFixedCrossAxisCount is the most common choice: a fixed number of columns, with row heights determined automatically.

Sizing Columns by Width Instead of Count

For a responsive grid where the column count should adapt to screen width rather than being fixed, use SliverGridDelegateWithMaxCrossAxisExtent instead — you specify a maximum item width, and Flutter fits as many columns as will comfortably fit:

gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
  maxCrossAxisExtent: 200,
  mainAxisSpacing: 8,
  crossAxisSpacing: 8,
),

Choosing Between Them

The decision is almost always about content shape, not performance — both are equally efficient when built with their .builder constructors:

  • ListView — content that reads naturally top to bottom: a chat, a feed, settings, search results.
  • GridView — content that’s visually browsed rather than read in order: a photo gallery, a product catalog, an icon picker.

For something in between — a list where certain rows should span multiple columns — look at SliverGrid with a custom delegate, or consider whether the layout is really trying to be a Wrap instead.

Frequently asked questions

Does ListView.builder work with infinite/paginated data?

Yes, pair it with a ScrollController to detect when the user nears the bottom, then fetch and append the next page of items to the list backing itemBuilder. ListView.builder itself doesn’t fetch data; it only lazily builds visible widgets.

Can a GridView have items of different sizes?

Not directly with the standard gridDelegate classes, which enforce uniform cell sizes. For a Pinterest-style staggered layout, use a third-party package like flutter_staggered_grid_view instead.

Why does my ListView throw “Vertical viewport was given unbounded height”?

This happens when a ListView is placed inside another unconstrained scrolling widget (like a Column) without a fixed height. Wrap it in Expanded, a SizedBox with a height, or set shrinkWrap: true for small lists only, since it disables lazy building.