My screen has three widgets :
- First one is a ListView of widgets, the number of widgets can be incremented with a button. I want the ListView to take only the required space that's why I wrapped it in Flexible, but I don't want it to exceed the height of 266. (If it takes more than 266px, it becomes scrollable).
- Second one is a widget that will take all the remaining space, it's wrapped in Expended.
- Third one is just a button with defined height.
The code is something like :
Scaffold(
body : Column(
children:[
Flexible(child: Widget1()),
Expanded(child: Widget2()),
Button(),
])
)
I tried wrapping the Flexible in a ConstrainedBox and gave it a max height of 266, but the Widget1 took all the 266 height.
In short, I want Widget1 to take the required space, but it can't exceed 266. Anyone has a solution for this?