Flutter Vertical viewport was given unbounded height. 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: <Widget>[
ListView(
shrinkWrap: true, // use this
),
],
)
----------------------------
2 . Wrap ListView in Expanded
Column(
children: <Widget>[
Expanded( // wrap in Expanded
child: ListView(...),
),
],
)
Example 3: Vertical viewport was given unbounded height.
Column(
children: <Widget>[
ListView(
shrinkWrap: true, // use this
),
],
)
Example 4: Vertical viewport was given unbounded height.
Column(
children: <Widget>[
SizedBox(
height: 400, // fixed height
child: ListView(...),
),
],
)