EdsonBueno / infinite_scroll_pagination

Flutter package to help you lazily load and display pages of items as the user scrolls down your screen.
https://pub.dev/packages/infinite_scroll_pagination
MIT License
605 stars 201 forks source link

PagedListView can't properly fetch data inside SingleChildScrollView #335

Closed 3kdeveloper closed 3 days ago

3kdeveloper commented 1 week ago

When I use PagedListView outside SingleChildScrollView it works fine. It fetches the data when I scroll to the bottom, See the code below.

PagedListViewWidget( pagingController: _pagingController, padding: EdgeInsets.symmetric(vertical: 20.pv), itemBuilder: (context, transfer, index) => BookingTileWidget( transfer: transfer, pagingController: _pagingController, index: index, ), placeHolderWidget: Padding( padding: EdgeInsets.only(bottom: 50.pv), child: PlaceHolderWidget( child: BookingTileWidget( transfer: TransferModel(), pagingController: _pagingController, index: -1, ), ), ), ),

But when I put it inside SingleChildScrollView it fetches all data page by page (on first attempt) without any scrolling o.

SingleChildScrollView( physics: const BouncingScrollPhysics(), child: Column( children: [ PagedListViewWidget( pagingController: _pagingController, padding: EdgeInsets.symmetric(vertical: 20.pv), physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, transfer, index) => BookingTileWidget( transfer: transfer, pagingController: _pagingController, index: index, ), placeHolderWidget: Padding( padding: EdgeInsets.only(bottom: 50.pv), child: PlaceHolderWidget( child: BookingTileWidget( transfer: TransferModel(), pagingController: _pagingController, index: -1, ), ), ), ), ], ), )

osmancan23 commented 3 days ago

Yes . I am getting the same error too

clragon commented 3 days ago

PagedListViewWidget is already a scrollable Widget and cannot be placed inside another scrollable Widget. You dont need to do this, and you shouldnt. If you need to have other elements that scroll with the Paged widget, you can use a CustomScrollView plus the corresponding Paged Sliver variant, like PagedSliverList.

osmancan23 commented 3 days ago

PagedListViewWidget is already a scrollable Widget and cannot be placed inside another scrollable Widget. You dont need to do this, and you shouldnt. If you need to have other elements that scroll with the Paged widget, you can use a CustomScrollView plus the corresponding Paged Sliver variant, like PagedSliverList.

Yes, scrollability is already available in the pagination list view, but since I want visibility under the bottom bar on my screen, I need to make a scaffold extend body true and wrap it with a scroll view. When you do it this way, it automatically sends requests one after the other.

I want a view like this: Simulator Screenshot - iPhone 15 - 2024-07-06 at 17 13 24

If I don't use scroll view, I get an image like this:

Simulator Screenshot - iPhone 15 - 2024-07-06 at 17 14 47