how to place a listview inside a SingleChildScrollView but prevent them from scrolling separately?

后端 未结 6 909
我在风中等你
我在风中等你 2020-12-15 17:10

I have a widget tree like this:

SingleChildScrollView
   Column
     Container
       ListView(or GridView)

the problem is that when my wid

6条回答
  •  执念已碎
    2020-12-15 17:48

    As suggested by other answers, you can do that by setting shrinkWrap: true, physics: NeverScrollableScrollPhysics(), but building a shrinkwrapped listview is more expensive than building a normal listview, I think it will be a good idea to use a map() on the list.

    Column(
      children: [
        ...itemList.map((item) {
           return Text(item);
        }).toList(),
      ],
    ),
    

提交回复
热议问题