-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SliverInfiniteList sometimes requires an extra pull to load more items #41
Comments
Hey @b-nugent, thanks for taking the time to report this. To add more context, this behavior is also observed in the nonsliver implementation before 0.5.0. LMK if you want to tackle it (based on that impl) otherwise we add this to the queue of stuff to do. |
@b-nugent thanks for the lovely comment and for opening the issue 🥹💙 @renancaraujo worked on the I was wondering if you have a minimal reproductive code you could share to have a look at 👀 |
Hey @renancaraujo and @alestiago! Here is the implementation that we're using:
This list brings up the loading indicator at the bottom of the list as the user is scrolling and more list items need to be loaded in. We swapped in the SliverInfiniteList with the same values for onFetchData, itemCount, itemBuilder, hasReachedMax, and isLoading, but found that the loading indicator doesn't show when the last of the list items is scrolled to. Instead, the user has to pull up a second time to see the loading indicator and bring up more items. |
After investigating, found that maxScrollExtent is not always up to date. We cannot rely on ScrollPosition anymore since it is not trustworthy for our case. The technique of refetching upon the last item build is quite clever since we can rely on the sliver list dynamics to trigger refetch. |
Describe the bug
My team had a SliverInfiniteList created by @alestiago (thanks Alejandro!!) before it was provided through this package in version 0.5.0. We attempted to swap in the SliverInfiniteList and noticed that by default the SliverInfiniteList sometimes requires an additional pull-up in order to load and display new items when the list reaches the end of what is loaded. We believe this may be due to how the effectiveItemCount is calculated, how the end of the list is determined, and how that results in the display of the loadingBuilder.
To Reproduce
Using a SliverInfiniteList that is the last sliver in a CustomScrollView, which has a loadingBuilder and the ability to load more list items:
Expected behavior
What we expected (which reflects the behavior of the custom SliverInfiniteList made by VGV for our team) is that as the user scrolls down the list and reaches the end of the loaded data, the loading indicator (supplied by the loadingBuilder) is displayed at the very bottom of the list, and new list items begin to load. This causes the overall scrolling and loading to flow more naturally and reduces the need for the user to pull up again when the list runs out of displayable entries.
Additional context
Let us know if you'd like videos showcasing the difference in behavior, we're happy to send them to the team if needed.
The text was updated successfully, but these errors were encountered: