mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: unify trending api & feat: search recommend (#694)
* opt: unify trending api * opt: disable icon * feat: search recommend * mod: recommend api
This commit is contained in:
committed by
GitHub
parent
3638d65008
commit
f0e3b776bb
@@ -5,7 +5,7 @@ import 'package:PiliPlus/models/search/search_trending/trending_list.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
|
||||
class SearchTrendingController
|
||||
extends CommonListController<TrendingData, TrendingList> {
|
||||
extends CommonListController<TrendingData, SearchKeywordList> {
|
||||
int topCount = 0;
|
||||
|
||||
@override
|
||||
@@ -15,10 +15,11 @@ class SearchTrendingController
|
||||
}
|
||||
|
||||
@override
|
||||
List<TrendingList>? getDataList(TrendingData response) {
|
||||
List<TrendingList> topList = (response.topList ?? <TrendingList>[]);
|
||||
List<SearchKeywordList>? getDataList(TrendingData response) {
|
||||
List<SearchKeywordList> topList = response.topList ?? <TrendingList>[];
|
||||
topCount = topList.length;
|
||||
return topList + (response.list ?? <TrendingList>[]);
|
||||
return response.list == null ? topList : topList
|
||||
..addAll(response.list ?? []);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -123,7 +123,7 @@ class _SearchTrendingPageState extends State<SearchTrendingPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody(LoadingState<List<TrendingList>?> loadingState) {
|
||||
Widget _buildBody(LoadingState<List<SearchKeywordList>?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => SliverToBoxAdapter(child: LinearProgressIndicator()),
|
||||
Success() => loadingState.response?.isNotEmpty == true
|
||||
|
||||
Reference in New Issue
Block a user