Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter - Listview.builder inside another Listview

Tags:

I want my screen to be scrollable so I put everything in a Listview.

Now I want to show another Listview inside to show details of a List. When I try this an error is thrown - " Expanded widgets must be placed inside Flex widgets."

enter image description here

like image 248
Ayoob Khan Avatar asked Nov 25 '18 07:11

Ayoob Khan


People also ask

Can we use ListView inside ListView in flutter?

You can wrap your ListView widget inside the Expanded widget and this will allow the ListView to take all the available as long as the Column allows.

How do you make a nested list in flutter?

To create nested list we use the List. filled( ) or List. generate( ) constructors. 2D, 3D, 4D Lists are an example of a nested array.

How do I use ListView separated in flutter?

separated. In Flutter, you can use ListView. separated to easily create a list view whose items are separated by separators (or dividers). A separator only appears between two list items and never stands before the first or sits after the last item.


1 Answers

Add shrinkWrap: true in listView.builder & Remove the top most Container or replace it with Column.

like image 61
anmol.majhail Avatar answered Sep 19 '22 04:09

anmol.majhail