cache follow order type

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-12-07 11:23:51 +08:00
parent 5b6443cfa4
commit 2cb8331528
4 changed files with 23 additions and 6 deletions

View File

@@ -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() {

View File

@@ -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)),