Vertical viewport was given unbounded height flutter code example

Example 1: Vertical viewport was given unbounded height.

ListView.builder(
    scrollDirection: Axis.vertical,
    shrinkWrap: true,
...

Example 2: vertical viewport was given unbounded height listview flutter

Use shrinkWrap: true in ListView.

Column(
  children: [
    ListView(
      shrinkWrap: true, // use this
    ),
  ],
)
----------------------------
2 . Wrap ListView in Expanded

Column(
  children: [
    Expanded( // wrap in Expanded
      child: ListView(...),
    ),
  ],
  )

Example 3: Vertical viewport was given unbounded height.

Column(
  children: [
    SizedBox(
      height: 400, // fixed height
      child: ListView(...),
    ),
  ],
)

Tags:

Misc Example