mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-03 00:29:42 +08:00
opt: escape performReassemble (#1864)
This commit is contained in:
committed by
GitHub
parent
96f9972895
commit
aee4424dbf
@@ -9,6 +9,7 @@ import 'package:PiliPlus/pages/home/view.dart';
|
||||
import 'package:PiliPlus/pages/mine/controller.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/popup_item.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart';
|
||||
import 'package:PiliPlus/utils/extension/get_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
@@ -17,7 +18,6 @@ import 'package:flex_seed_scheme/flex_seed_scheme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
class ColorSelectPage extends StatefulWidget {
|
||||
const ColorSelectPage({super.key});
|
||||
@@ -44,19 +44,13 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
|
||||
Future<void> _onChanged([bool? val]) async {
|
||||
val ??= !ctr.dynamicColor.value;
|
||||
if (val) {
|
||||
if (await MyApp.initPlatformState()) {
|
||||
Get.forceAppUpdate();
|
||||
} else {
|
||||
SmartDialog.showToast('该设备可能不支持动态取色');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Get.forceAppUpdate();
|
||||
if (val && !await MyApp.initPlatformState()) {
|
||||
SmartDialog.showToast('设备可能不支持动态取色');
|
||||
return;
|
||||
}
|
||||
ctr
|
||||
..dynamicColor.value = val
|
||||
..setting.put(SettingBoxKey.dynamicColor, val);
|
||||
ctr.dynamicColor.value = val;
|
||||
await GStorage.setting.put(SettingBoxKey.dynamicColor, val);
|
||||
Get.updateMyAppTheme();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -117,8 +111,9 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
.toList(),
|
||||
onSelected: (value, setState) {
|
||||
_dynamicSchemeVariant = value;
|
||||
GStorage.setting.put(SettingBoxKey.schemeVariant, value.index);
|
||||
Get.forceAppUpdate();
|
||||
GStorage.setting
|
||||
.put(SettingBoxKey.schemeVariant, value.index)
|
||||
.whenComplete(Get.updateMyAppTheme);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -131,10 +126,7 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
value: ctr.dynamicColor.value,
|
||||
onChanged: _onChanged,
|
||||
materialTapTargetSize: .shrinkWrap,
|
||||
visualDensity: const VisualDensity(
|
||||
horizontal: -4,
|
||||
vertical: -4,
|
||||
),
|
||||
visualDensity: const .new(horizontal: -4, vertical: -4),
|
||||
),
|
||||
),
|
||||
onTap: _onChanged,
|
||||
@@ -162,13 +154,10 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
ctr
|
||||
..currentColor.value = index
|
||||
..setting.put(
|
||||
SettingBoxKey.customColor,
|
||||
index,
|
||||
);
|
||||
Get.forceAppUpdate();
|
||||
ctr.currentColor.value = index;
|
||||
GStorage.setting
|
||||
.put(SettingBoxKey.customColor, index)
|
||||
.whenComplete(Get.updateMyAppTheme);
|
||||
},
|
||||
child: Column(
|
||||
spacing: 3,
|
||||
@@ -236,6 +225,4 @@ class _ColorSelectController extends GetxController {
|
||||
final RxBool dynamicColor = Pref.dynamicColor.obs;
|
||||
final RxInt currentColor = Pref.customColor.obs;
|
||||
final Rx<ThemeType> themeType = Pref.themeType.obs;
|
||||
|
||||
Box get setting => GStorage.setting;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user