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
612 stars 202 forks source link

CustomScrollView with cacheExtent causing excessive loading #271

Closed Stumblinbear closed 11 months ago

Stumblinbear commented 1 year ago

I'm using the cacheExtent property on a CustomScrollView in order to keep the size of the scrollbar relatively consistent. This is because each item in my list is not guaranteed to be the same height (there can be relatively large variations). However, this causes the PagedSliverList to load items much deeper in the list than is necessary. My scrollbar rarely gets further than halfway down the screen due to the necessity of a large cacheExtent (5k-10k pixels).

Is there a way to use the visual location (viewport?) of the end of the list rather than the items that haven't been laid out?

clragon commented 11 months ago

cacheExtent builds all the items that are inside of its radius; to build the item, they must exist and be requested. They are also laid out, according to the documentation.

Given this, I dont know how what you request could be possible. You are essentially instructing the scrollview to build many items, and therefore many items are built.

Stumblinbear commented 11 months ago

Ideally you could cacheExtent only items above the viewport, not below. A large cacheExtent is necessary for visual scrollbar consistency, but that doesn't have to include the exact same amount of items below the viewport, so you could delay loading new items until you reach nearly the bottom of the list visually (not necessarily at the whims of cacheExtent). If this is a limitation of Flutter and not this library, then oke doke