I have a TabBarView() with an amount of different views. I want of them to be a Column with a TextField at top and a ListView.Builder() below, but both widgets should be in
Reason for the error:
Column
expands to the maximum size in main axis direction (vertical axis), and so does the ListView
Solution
You need to constrain the height of the ListView
, so that it does expand to match Column
, there are several ways of solving this issue, I'm listing a few here:
If you want to allow ListView
to take up all remaining space inside Column
use Flexible
.
Column(
children: [
Flexible(
child: ListView(...),
)
],
)
If you want to limit your ListView
to certain height
, you can use SizedBox
.
Column(
children: [
SizedBox(
height: 200, // constrain height
child: ListView(),
)
],
)
If your ListView
is small, you may try shrinkWrap
property on it.
Column(
children: [
ListView(
shrinkWrap: true, // use it
)
],
)