I have a column where I want to put two ListViews like below
Column
- ListView#1
- ListView#2
I have added already ListView#1 and getting error when I try to add the ListVeiw#2 to the column. The error message is;
A Column cannot bet set to Scrollable when a child is set to Expanded
3
Answers
The error you’re encountering is due to the fact that a Column with Expanded children is essentially an infinite Scrollable widget, and as a result, the Column widget itself cannot be made Scrollable.
Here’s a simple solution: You can wrap your ListViews in a Flexible widget. The Flexible widget allows the child to have a flexible height. Here’s an example:
This will make each ListView have a flexible height, which allows them to be able to grow and shrink to fit the available space in the Column. As a result, the Column itself does not need to be made Scrollable.
For both use inside your
ListView
use the below propertiesYou can also follow this tutorial
You can try
Expanded
widgetWhat is the difference between the
Expanded
widget and theFlexible
widget?