Home > other >  How can I fill the height of the ListView.builder to fill the available space inside the scrollable
How can I fill the height of the ListView.builder to fill the available space inside the scrollable

Time:01-29

I have a ListView.builder that uses shrinkWrap because I get an error if I don't use it.

As a result of enter image description here

Note: You dont have to use shrinkWrap:true everytime , it is preffered to be used, only when your listView is inside another Scrollable view. Else it is preffered to be false which is the option by default


Refer the docs:

Shrink wrapping the content of the scroll view is significantly more expensive than expanding to the maximum allowed size because the content can expand and contract during scrolling, which means the size of the scroll view needs to be recomputed whenever the scroll position changes.

CodePudding user response:

Instead of using ListView.builder, you should use Column:

Column(
  children: list.map((element) => …).toList(),
),
  • Related