Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-06 14:14:19 +08:00
parent 1a8c348af1
commit 07843a5e77
239 changed files with 3175 additions and 13237 deletions

View File

@@ -1,14 +1,15 @@
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/http/video.dart';
import 'package:PiliPlus/models/home/rcmd/result.dart';
import 'package:PiliPlus/pages/common/common_list_controller.dart';
import 'package:PiliPlus/utils/storage_pref.dart';
class RcmdController extends CommonListController {
late bool enableSaveLastData = Pref.enableSaveLastData;
final bool appRcmd = Pref.appRcmd;
class RcmdController
extends
CommonListController<
List<RcmdVideoItemAppModel>,
RcmdVideoItemAppModel
> {
int? lastRefreshAt;
late bool savedRcmdTip = Pref.savedRcmdTip;
@override
void onInit() {
@@ -18,20 +19,15 @@ class RcmdController extends CommonListController {
}
@override
Future<LoadingState> customGetData() {
return appRcmd
? VideoHttp.rcmdVideoListApp(freshIdx: page)
: VideoHttp.rcmdVideoList(freshIdx: page, ps: 20);
}
Future<LoadingState<List<RcmdVideoItemAppModel>>> customGetData() =>
VideoHttp.rcmdVideoListApp(freshIdx: page);
@override
void handleListResponse(List dataList) {
if (enableSaveLastData && page == 0) {
void handleListResponse(List<RcmdVideoItemAppModel> dataList) {
if (page == 0) {
if (loadingState.value case Success(:final response)) {
if (response != null && response.isNotEmpty) {
if (savedRcmdTip) {
lastRefreshAt = dataList.length;
}
lastRefreshAt = dataList.length;
if (response.length > 200) {
dataList.addAll(response.take(50));
} else {