feat: 首页刷新逻辑 issues #133
This commit is contained in:
@ -14,6 +14,7 @@ class RcmdController extends GetxController {
|
|||||||
Box recVideo = GStrorage.recVideo;
|
Box recVideo = GStrorage.recVideo;
|
||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
RxInt crossAxisCount = 2.obs;
|
RxInt crossAxisCount = 2.obs;
|
||||||
|
late bool enableSaveLastData;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -28,6 +29,8 @@ class RcmdController extends GetxController {
|
|||||||
}
|
}
|
||||||
videoList.value = list;
|
videoList.value = list;
|
||||||
}
|
}
|
||||||
|
enableSaveLastData =
|
||||||
|
setting.get(SettingBoxKey.enableSaveLastData, defaultValue: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取推荐
|
// 获取推荐
|
||||||
@ -49,7 +52,11 @@ class RcmdController extends GetxController {
|
|||||||
videoList.value = res['data'];
|
videoList.value = res['data'];
|
||||||
}
|
}
|
||||||
} else if (type == 'onRefresh') {
|
} else if (type == 'onRefresh') {
|
||||||
|
if (enableSaveLastData) {
|
||||||
|
videoList.insertAll(0, res['data']);
|
||||||
|
} else {
|
||||||
videoList.value = res['data'];
|
videoList.value = res['data'];
|
||||||
|
}
|
||||||
} else if (type == 'onLoad') {
|
} else if (type == 'onLoad') {
|
||||||
videoList.addAll(res['data']);
|
videoList.addAll(res['data']);
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,12 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
setKey: SettingBoxKey.enableWordRe,
|
setKey: SettingBoxKey.enableWordRe,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
|
const SetSwitchItem(
|
||||||
|
title: '首页推荐刷新',
|
||||||
|
subTitle: '下拉刷新时保留上次内容',
|
||||||
|
setKey: SettingBoxKey.enableSaveLastData,
|
||||||
|
defaultVal: false,
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
title: Text('评论展示', style: titleStyle),
|
title: Text('评论展示', style: titleStyle),
|
||||||
|
@ -121,6 +121,7 @@ class SettingBoxKey {
|
|||||||
static const String enableWordRe = 'enableWordRe';
|
static const String enableWordRe = 'enableWordRe';
|
||||||
static const String enableSearchWord = 'enableSearchWord';
|
static const String enableSearchWord = 'enableSearchWord';
|
||||||
static const String enableRcmdDynamic = 'enableRcmdDynamic';
|
static const String enableRcmdDynamic = 'enableRcmdDynamic';
|
||||||
|
static const String enableSaveLastData = 'enableSaveLastData';
|
||||||
|
|
||||||
/// 外观
|
/// 外观
|
||||||
static const String themeMode = 'themeMode';
|
static const String themeMode = 'themeMode';
|
||||||
|
Reference in New Issue
Block a user