mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-21 08:38:37 +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)),
|
||||
|
||||
Reference in New Issue
Block a user