mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-23 04:00:28 +08:00
opt: escape performReassemble (#1864)
This commit is contained in:
committed by
GitHub
parent
96f9972895
commit
aee4424dbf
@@ -42,7 +42,7 @@ import 'package:PiliPlus/utils/update.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide RefreshIndicator;
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
@@ -972,7 +972,7 @@ Future<void> _showRefreshDragDialog(
|
||||
if (res != null) {
|
||||
kDragContainerExtentPercentage = res;
|
||||
await GStorage.setting.put(SettingBoxKey.refreshDragPercentage, res);
|
||||
Get.forceAppUpdate();
|
||||
setState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -993,7 +993,19 @@ Future<void> _showRefreshDialog(
|
||||
if (res != null) {
|
||||
displacement = res;
|
||||
await GStorage.setting.put(SettingBoxKey.refreshDisplacement, res);
|
||||
Get.forceAppUpdate();
|
||||
if (WidgetsBinding.instance.rootElement case final context?) {
|
||||
context.visitChildElements(_visitor);
|
||||
}
|
||||
setState();
|
||||
}
|
||||
}
|
||||
|
||||
void _visitor(Element context) {
|
||||
if (!context.mounted) return;
|
||||
if (context.widget is RefreshIndicator) {
|
||||
context.markNeedsBuild();
|
||||
} else {
|
||||
context.visitChildren(_visitor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/slider_dialog.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||
import 'package:PiliPlus/utils/extension/file_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/get_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
@@ -88,7 +89,7 @@ List<SettingsModel> get styleSettings => [
|
||||
setKey: SettingBoxKey.appFontWeight,
|
||||
defaultVal: false,
|
||||
leading: const Icon(Icons.text_fields),
|
||||
onChanged: (value) => Get.forceAppUpdate(),
|
||||
onChanged: (_) => Get.updateMyAppTheme(),
|
||||
onTap: _showFontWeightDialog,
|
||||
),
|
||||
NormalModel(
|
||||
@@ -132,7 +133,7 @@ List<SettingsModel> get styleSettings => [
|
||||
defaultVal: false,
|
||||
onChanged: (value) {
|
||||
if (value && MyApp.darkThemeData == null) {
|
||||
Get.forceAppUpdate();
|
||||
Get.updateMyAppTheme();
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -279,7 +280,7 @@ List<SettingsModel> get styleSettings => [
|
||||
defaultVal: false,
|
||||
onChanged: (value) {
|
||||
if (Get.isDarkMode || Pref.darkVideoPage) {
|
||||
Get.forceAppUpdate();
|
||||
Get.updateMyAppTheme();
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -634,7 +635,7 @@ Future<void> _showFontWeightDialog(BuildContext context) async {
|
||||
);
|
||||
if (res != null) {
|
||||
await GStorage.setting.put(SettingBoxKey.appFontWeight, res.toInt() - 1);
|
||||
Get.forceAppUpdate();
|
||||
Get.updateMyAppTheme();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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