mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-29 20:48:40 +00:00
cache follow order type
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -7,6 +7,9 @@ import 'package:PiliPlus/models_new/follow/data.dart';
|
||||
import 'package:PiliPlus/models_new/follow/list.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:PiliPlus/pages/follow/controller.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class FollowChildController
|
||||
@@ -21,7 +24,12 @@ class FollowChildController
|
||||
late final Rx<LoadingState<List<FollowItemModel>?>> sameState =
|
||||
LoadingState<List<FollowItemModel>?>.loading().obs;
|
||||
|
||||
late final Rx<FollowOrderType> orderType = FollowOrderType.def.obs;
|
||||
late final Rx<FollowOrderType> orderType = Pref.followOrderType.obs;
|
||||
|
||||
void setOrderType(FollowOrderType type) {
|
||||
orderType.value = type;
|
||||
GStorage.setting.put(SettingBoxKey.followOrderType, type.index);
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
|
||||
@@ -84,10 +84,11 @@ class _FollowChildPageState extends State<FollowChildPage>
|
||||
bottom: kFloatingActionButtonMargin + padding.bottom,
|
||||
child: FloatingActionButton.extended(
|
||||
onPressed: () => _followController
|
||||
..orderType.value =
|
||||
_followController.orderType.value == FollowOrderType.def
|
||||
? FollowOrderType.attention
|
||||
: FollowOrderType.def
|
||||
..setOrderType(
|
||||
_followController.orderType.value == FollowOrderType.def
|
||||
? FollowOrderType.attention
|
||||
: FollowOrderType.def,
|
||||
)
|
||||
..onReload(),
|
||||
icon: const Icon(Icons.format_list_bulleted, size: 20),
|
||||
label: Obx(() => Text(_followController.orderType.value.title)),
|
||||
|
||||
@@ -145,7 +145,8 @@ abstract class SettingBoxKey {
|
||||
enablePlayAll = 'enablePlayAll',
|
||||
enableTapDm = 'enableTapDm',
|
||||
setSystemBrightness = 'setSystemBrightness',
|
||||
downloadPath = 'downloadPath';
|
||||
downloadPath = 'downloadPath',
|
||||
followOrderType = 'followOrderType';
|
||||
|
||||
static const String minimizeOnExit = 'minimizeOnExit',
|
||||
windowSize = 'windowSize',
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:PiliPlus/common/widgets/pair.dart';
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/dynamic_badge_mode.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/up_panel_position.dart';
|
||||
import 'package:PiliPlus/models/common/follow_order_type.dart';
|
||||
import 'package:PiliPlus/models/common/member/tab_type.dart';
|
||||
import 'package:PiliPlus/models/common/msg/msg_unread_type.dart';
|
||||
import 'package:PiliPlus/models/common/sponsor_block/segment_type.dart';
|
||||
@@ -877,4 +878,10 @@ abstract class Pref {
|
||||
SettingBoxKey.showBatteryLevel,
|
||||
defaultValue: Utils.isMobile,
|
||||
);
|
||||
|
||||
static FollowOrderType get followOrderType =>
|
||||
FollowOrderType.values[_setting.get(
|
||||
SettingBoxKey.followOrderType,
|
||||
defaultValue: FollowOrderType.def.index,
|
||||
)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user