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
623 stars 211 forks source link

[Feature Request] PageView support #89

Closed clragon closed 3 years ago

clragon commented 3 years ago

Some of the grids in my app can be opened into a PageView. When the end of the pageview is reached, new data should be loaded and the grid should be also updated with that data. Using the pagingcontroller with the grid should be easy enough, and triggering an update from somewhere else should also work.

Could we get support for pageviews? I assume the PagedSliverBuilder is a vertical scroll view, and not suitable for this task.

EdsonBueno commented 3 years ago

Hi @clragon . Do you have any screenshots of the kind of layout you're trying to achieve? Thank you

clragon commented 3 years ago

Hi @EdsonBueno ,

Here is a diagram of the layout I would like to achieve:

e (3)

this package can easily provide loading indicators for grid views, but since my data can also be viewed in a page view, it would be nice to have some kind of support for page view pagination etc...

I would understand if this is not the goal of this package though.

EdsonBueno commented 3 years ago

Thank you for the diagram @clragon . Please, try replacing your PageView with a PagedListView with the following properties:

scrollDirection: Axis.horizontal,
physics: const PageScrollPhysics(),
EdsonBueno commented 3 years ago

I'm closing this due to inactivity, but feel free to continue the discussion. Thank you

clragon commented 3 years ago

hi @EdsonBueno, I have looked at the approach with PageScrollPhysics but my app also makes use of PageControllers function to be notified when the page is changed or to animate to / jump to specific items, which doesn't seem to be possible here.

vin-fandemand commented 3 years ago

any work around for this ?

Abacaxi-Nelson commented 3 years ago

hey @EdsonBueno i think i have same feature request. i am developing kind of tiktok; where each media take full height.

Pageview is the right widget for the task, but it will be awesome to have goodness from infinite_scroll_pagination with pageview..

EdsonBueno commented 3 years ago

Hey guys, I'll look on adding that to the package in the future, I'm just not sure when I'll have the time for that. In the meantime you have two solutions:

  1. Use PagedListView this way. The problem is you won't be able to use PageController to programmatically jump to specific items.
  2. Try creating a PagedPageView using this method. It shouldn't be hard. @clragon mentioned he was worried this solution is only suitable for vertical scroll, but that isn't true.
vin-fandemand commented 3 years ago

Hey guys, I'll look on adding that to the package in the future, I'm just not sure when I'll have the time for that. In the meantime you have two solutions:

  1. Use PagedListView this way. The problem is you won't be able to use PageController to programmatically jump to specific items.
  2. Try creating a PagedPageView using this method. It shouldn't be hard. @clragon mentioned he was worried this solution is only suitable for vertical scroll, but that isn't true.

@EdsonBueno In case of List and Grid, we could use the AppendDelegate thing to append the list to the end. In case of Page, its not an implementation of scrollbox and yet it is made by a scrolllistener which rendering a child inside a Viewport. So say putting PageView directly under the completedListingBuilder will not give you the same effect for Page.

EdsonBueno commented 3 years ago

Not sure I understand what you mean @vin-fandemand . Can you try explaining it another way? The AppendedSliverChildBuilderDelegate is a utility only to add the indicators as the last item of the Grid/List.

clragon commented 3 years ago

@EdsonBueno got it, I created a PagedPageView with the method you recommended. I will make an MR for it.