Decrease infinite scroll fetch index

This commit is contained in:
Tommy Chow 2022-07-05 05:28:58 -04:00
parent 89b385215a
commit 8215755eda
4 changed files with 4 additions and 12 deletions

View file

@ -74,15 +74,7 @@ abstract class ListStoreBase with Store {
});
}
switch (listType) {
case ListType.followed:
if (listType == ListType.followed && authStore.isLoggedIn) getStreams();
break;
case ListType.top:
case ListType.category:
getStreams();
break;
}
getStreams();
}
/// Fetches the streams based on the type and current cursor.

View file

@ -88,7 +88,7 @@ class _CategoriesState extends State<Categories> with AutomaticKeepAliveClientMi
),
itemCount: _categoriesStore.categories.length,
itemBuilder: (context, index) {
if (index > _categoriesStore.categories.length - 8 && _categoriesStore.hasMore) {
if (index > _categoriesStore.categories.length - 10 && _categoriesStore.hasMore) {
_categoriesStore.getCategories();
}
return CategoryCard(

View file

@ -145,7 +145,7 @@ class _CategoryStreamsState extends State<CategoryStreams> {
sliver: SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index > _listStore.streams.length - 8 && _listStore.hasMore) {
if (index > _listStore.streams.length - 10 && _listStore.hasMore) {
_listStore.getStreams();
}
return Observer(

View file

@ -95,7 +95,7 @@ class _StreamsListState extends State<StreamsList> with AutomaticKeepAliveClient
controller: widget.scrollController,
itemCount: _listStore.streams.length,
itemBuilder: (context, index) {
if (index > _listStore.streams.length - 8 && _listStore.hasMore) {
if (index > _listStore.streams.length - 10 && _listStore.hasMore) {
debugPrint('$index ${_listStore.streams.length}');
_listStore.getStreams();