a CupertinoSliverRefreshControl like load more sliver
- support
CustomerScrollView - support autoload and preload(only if cacheExtent > 0)
- similar to
CupertinoSliverRefreshControluseage - support horizontal scroll direction
late ValueNotifier<int> _count;
Future<void> loadMore() async {
await Future.delayed(const Duration(seconds: 1));
_count.value = _count.value + 8;
}
CustomScrollView(slivers: [
ValueListenableBuilder(
valueListenable: _count,
builder: (c, value, _) {
return SliverList(
...
]));
}),
LoadMoreController(onLoad: loadMore),
]);CustomScrollView(
cacheExtent: 500,
slivers: [
LoadMoreController(
onLoad: loadMore,
autoLoad: true,
)
],
);if the autoLoad argument be true:
onLoadwill be called when viewport not filledonLoadwill be called when theLoadMoreControllerreach thecacheExtentof the viewport,cacheExtentcan be modified to control the preloading timing