diff --git a/lib/pages/fav_search/controller.dart b/lib/pages/fav_search/controller.dart index c2efe2fbc..c3e6d785b 100644 --- a/lib/pages/fav_search/controller.dart +++ b/lib/pages/fav_search/controller.dart @@ -52,13 +52,17 @@ class FavSearchController extends CommonController { List? dataList = searchType == SearchType.fav ? (currentPage == 1 ? response.response.medias - : currentList + response.response.medias) + : response.response.medias != null + ? currentList + response.response.medias + : currentList) : (currentPage == 1 ? response.response.list - : currentList + response.response.list); + : response.response.list != null + ? currentList + response.response.list + : currentList); isEnd = searchType == SearchType.fav ? response.response.hasMore == false - : response.response.list.isEmpty; + : response.response.list == null || response.response.list.isEmpty; loadingState.value = LoadingState.success(dataList); return true; } diff --git a/lib/pages/fav_search/view.dart b/lib/pages/fav_search/view.dart index a4ce04d47..dbe2fa414 100644 --- a/lib/pages/fav_search/view.dart +++ b/lib/pages/fav_search/view.dart @@ -123,6 +123,9 @@ class _FavSearchPageState extends State { ) : _favSearchCtr.searchType == SearchType.follow ? ListView.builder( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).padding.bottom + 80, + ), controller: _favSearchCtr.scrollController, itemCount: loadingState.response.length, itemBuilder: ((context, index) { @@ -138,24 +141,29 @@ class _FavSearchPageState extends State { physics: const AlwaysScrollableScrollPhysics(), controller: _favSearchCtr.scrollController, slivers: [ - SliverGrid( - gridDelegate: SliverGridDelegateWithExtentAndRatio( - mainAxisSpacing: 2, - maxCrossAxisExtent: Grid.mediumCardWidth * 2, - childAspectRatio: StyleString.aspectRatio * 2.2, + SliverPadding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).padding.bottom + 80, ), - delegate: SliverChildBuilderDelegate( - (context, index) { - if (index == loadingState.response.length - 1) { - _favSearchCtr.onLoadMore(); - } - return HistoryItem( - videoItem: loadingState.response[index], - ctr: _favSearchCtr, - onChoose: null, - ); - }, - childCount: loadingState.response.length, + sliver: SliverGrid( + gridDelegate: SliverGridDelegateWithExtentAndRatio( + mainAxisSpacing: 2, + maxCrossAxisExtent: Grid.mediumCardWidth * 2, + childAspectRatio: StyleString.aspectRatio * 2.2, + ), + delegate: SliverChildBuilderDelegate( + (context, index) { + if (index == loadingState.response.length - 1) { + _favSearchCtr.onLoadMore(); + } + return HistoryItem( + videoItem: loadingState.response[index], + ctr: _favSearchCtr, + onChoose: null, + ); + }, + childCount: loadingState.response.length, + ), ), ), ],