TatsuUkraine / flutter_sticky_infinite_list

Multi directional infinite list with Sticky headers for Flutter applications
BSD 2-Clause "Simplified" License
341 stars 31 forks source link

What should I watch or what method could I use to make a request for more data #18

Closed jamesmenera closed 4 years ago

jamesmenera commented 4 years ago

I apologize if I am just missing something, but how do I know that I am getting towards on end of my rendered data and to trigger a request for more? Read through the code base and it was still not clear what should trigger to make a call

TatsuUkraine commented 4 years ago

You need to load more data on scroll end or when container with header goes outside of viewport?

TatsuUkraine commented 4 years ago

@jamesmenera ?

TatsuUkraine commented 4 years ago

@jamesmenera do you still need any help with this issue?) if not, I will close it later today

TatsuUkraine commented 4 years ago

closing this issue, since didn't get any response. @jamesmenera feel free to reach me or open issue if you need any help

tudor07 commented 4 years ago

I have the same question. I use a NotificationListener to listen for ScrollEndNotification. To check whether user reached the top I use this:

 if (_scrollCtrl.position.pixels.toInt() ==
          _scrollCtrl.position.minScrollExtent.toInt())

But I get this error:

Unhandled Exception: Unsupported operation: Infinity or NaN toInt
TatsuUkraine commented 4 years ago

@tudor07 according to docs minScrollExtent can actually be infinite, if a scroll is infinite. If you want to load data when a user scrolls to the end of the scroll - you need to make it finite, which means that you need to define max pos/neg params, if you using InfiniteList widget from this package, or use your delegate with items count property, hard to say without actual code)

tudor07 commented 4 years ago

@TatsuUkraine thanks, it worked with specifying negChildCount and posChildCount