# Flutter: Vertical viewport was given unbounded height. Viewports expand in the scrolling direction to fill their container

**Code:** `Vertical viewport was given unbounded height` · **Category:** Flutter / Dart · **Seen on:** Flutter

A scrollable (ListView, GridView) sits inside a parent that does not limit its height, so it tries to be infinitely tall.

## Meaning

A `Column` gives children unbounded height. A `ListView` inside it wants to fill that infinite space and throws. Give the list a bounded height with `Expanded`, `SizedBox` or `shrinkWrap`, or use a `CustomScrollView` with slivers for mixed content.

## Common causes

- ListView directly inside a Column
- ListView inside another scrollable (SingleChildScrollView)
- GridView inside Column without Expanded
- TabBarView or PageView inside Column without Expanded
- Missing height in a Row/Column nesting

## Quick fix

1. Wrap the ListView in `Expanded(child: …)`
2. Or use `shrinkWrap: true` plus `physics: NeverScrollableScrollPhysics()` for small lists
3. Use slivers for complex pages

## Detailed fix by platform

### Flutter

1. A column with a header and list: `Column(children:[Header(), Expanded(child: ListView(...))])`

## Code examples

### Bound the list

```dart
Column(
  children: [
    const Text('Header'),
    Expanded(               // gives the ListView a finite height
      child: ListView.builder(
        itemCount: items.length,
        itemBuilder: (_, i) => ListTile(title: Text(items[i])),
      ),
    ),
  ],
)
```

## How to diagnose

1. **Parent** — Column/Row/Scroll view?
2. **Fix** — Expanded or fixed height?
3. **Alternative** — Slivers?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/flutter/vertical-viewport-unbounded-height)
