robert-luoqing / flutter_list_view

MIT License
47 stars 17 forks source link

How to do pagination with this package ? #33

Closed nergal79 closed 5 months ago

nergal79 commented 5 months ago

We have a need of pagination in vertical list view . 2-way actually both top and bottom .. How this can be achieved ? I don't see any scroll change listener in the code like Google's ListView package has ..

robert-luoqing commented 5 months ago

Please refer https://github.com/robert-luoqing/flutter_list_view/blob/master/example/lib/pull_to_refresh_list.dart. It integrates with pull_to_refresh to implement pagination

nergal79 commented 5 months ago

@robert-luoqing that's not I meant by pagination .. I need to make next page call once the list is at bottom/top. So i need to detect that..

Anyways I found the answer. I am using the code below . and it works fine..

 `listViewController.sliverController.onPaintItemPositionsCallback =
    (double widgetHeight, List<FlutterListViewItemPosition> positions) {
  var firstVisiblePosition = positions.first;
  var lastVisiblePosition = positions.last;
  // here we can build logic around above position to call the next/prev page 

};`   

Thanks for this amazing package man! Bless You ...