fix: fav search

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-24 10:16:01 +08:00
parent 8ddf42fff1
commit f110c2a55f
2 changed files with 32 additions and 20 deletions

View File

@@ -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;
}

View File

@@ -123,6 +123,9 @@ class _FavSearchPageState extends State<FavSearchPage> {
)
: _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<FavSearchPage> {
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,
),
),
),
],