Home > other >  Flutter: Page doesn't scroll when have listview in page
Flutter: Page doesn't scroll when have listview in page

Time:06-14

I have listview in scrollable page. After scroll listview down to the bottom and go back to the top of the listview it won't able to scroll the page. However I try to wrap listview in the Singlechildscrollview but it won't work

actual

https://drive.google.com/file/d/1NEDJ6b0A1qVEvLjn7i_V_8AYSo1UQecy/view?usp=sharing

expect

https://drive.google.com/file/d/10V82xMtllsVRIOUhW8bgfuR9T4f9aV7C/view?usp=sharing

CodePudding user response:

Try to wrap the list view in a Singlechildscrollview then add neverscrollablescrollphysics to the List view.

And if you face an issue with the layout you can set the shrinkWrap property of the List view to true.

It will be something like the following:

SingleChildScrollView(
   child: ListView.builder(
     physics: NeverScrollableScrollPhysics(),
     shrinkWrap: true, // Only if you have layout issue
     itemBuilder: (context, index) => Container(),
     itemCount: 10,
   ),
),

CodePudding user response:

You can use multiple lists with their own scroll behaviour using the SliverList Widget.

Refer here: SliverList-class

You can get a demo here: SliverList Demo

  • Related