mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-25 04:45:54 +08:00
@@ -6,6 +6,8 @@ import 'package:PiliPlus/pages/home/view.dart';
|
||||
import 'package:PiliPlus/pages/mine/controller.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flex_seed_scheme/flex_seed_scheme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -42,7 +44,7 @@ List<Item> generateItems(int count) {
|
||||
class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
final ColorSelectController ctr = Get.put(ColorSelectController());
|
||||
FlexSchemeVariant _dynamicSchemeVariant =
|
||||
FlexSchemeVariant.values[GStorage.schemeVariant];
|
||||
FlexSchemeVariant.values[Pref.schemeVariant];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -64,9 +66,8 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
return SelectDialog<ThemeType>(
|
||||
title: '主题模式',
|
||||
value: ctr.themeType.value,
|
||||
values: ThemeType.values
|
||||
.map((e) => (e, e.description))
|
||||
.toList());
|
||||
values:
|
||||
ThemeType.values.map((e) => (e, e.desc)).toList());
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
@@ -84,8 +85,7 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
child: const Icon(Icons.flashlight_on_outlined),
|
||||
),
|
||||
title: Text('主题模式', style: titleStyle),
|
||||
subtitle: Obx(() => Text(
|
||||
'当前模式:${ctr.themeType.value.description}',
|
||||
subtitle: Obx(() => Text('当前模式:${ctr.themeType.value.desc}',
|
||||
style: subTitleStyle)),
|
||||
),
|
||||
Obx(
|
||||
@@ -155,8 +155,9 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
title: const Text('动态取色'),
|
||||
groupValue: ctr.type.value,
|
||||
onChanged: (dynamic val) {
|
||||
ctr.type.value = 0;
|
||||
ctr.setting.put(SettingBoxKey.dynamicColor, true);
|
||||
ctr
|
||||
..type.value = 0
|
||||
..setting.put(SettingBoxKey.dynamicColor, true);
|
||||
Get.forceAppUpdate();
|
||||
},
|
||||
),
|
||||
@@ -167,8 +168,9 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
title: const Text('指定颜色'),
|
||||
groupValue: ctr.type.value,
|
||||
onChanged: (dynamic val) {
|
||||
ctr.type.value = 1;
|
||||
ctr.setting.put(SettingBoxKey.dynamicColor, false);
|
||||
ctr
|
||||
..type.value = 1
|
||||
..setting.put(SettingBoxKey.dynamicColor, false);
|
||||
Get.forceAppUpdate();
|
||||
},
|
||||
),
|
||||
@@ -254,23 +256,11 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
}
|
||||
|
||||
class ColorSelectController extends GetxController {
|
||||
RxBool dynamicColor = true.obs;
|
||||
RxInt type = 0.obs;
|
||||
RxInt currentColor = 0.obs;
|
||||
RxDouble currentTextScale = 1.0.obs;
|
||||
Rx<ThemeType> themeType = GStorage.themeType.obs;
|
||||
final RxBool dynamicColor = Pref.dynamicColor.obs;
|
||||
late final RxInt type = (dynamicColor.value ? 0 : 1).obs;
|
||||
final RxInt currentColor = Pref.customColor.obs;
|
||||
final RxDouble currentTextScale = Pref.defaultTextScale.obs;
|
||||
final Rx<ThemeType> themeType = Pref.themeType.obs;
|
||||
|
||||
Box get setting => GStorage.setting;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
dynamicColor.value =
|
||||
setting.get(SettingBoxKey.dynamicColor, defaultValue: true);
|
||||
type.value = dynamicColor.value ? 0 : 1;
|
||||
currentColor.value =
|
||||
setting.get(SettingBoxKey.customColor, defaultValue: 0);
|
||||
currentTextScale.value =
|
||||
setting.get(SettingBoxKey.defaultTextScale, defaultValue: 1.0);
|
||||
super.onInit();
|
||||
}
|
||||
Box setting = GStorage.setting;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show PlatformException;
|
||||
@@ -18,7 +19,7 @@ class _SetDisplayModeState extends State<SetDisplayMode> {
|
||||
DisplayMode? active;
|
||||
DisplayMode? preferred;
|
||||
|
||||
Box get setting => GStorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
class FontSizeSelectPage extends StatefulWidget {
|
||||
const FontSizeSelectPage({super.key});
|
||||
@@ -12,23 +13,12 @@ class FontSizeSelectPage extends StatefulWidget {
|
||||
|
||||
class _FontSizeSelectPageState extends State<FontSizeSelectPage> {
|
||||
List<double> list = List.generate(16, (index) => 0.85 + index * 0.05);
|
||||
late double minSize;
|
||||
late double maxSize;
|
||||
late double currentSize;
|
||||
|
||||
Box get setting => GStorage.setting;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
minSize = list.first;
|
||||
maxSize = list.last;
|
||||
currentSize =
|
||||
setting.get(SettingBoxKey.defaultTextScale, defaultValue: 1.0);
|
||||
}
|
||||
late double minSize = list.first;
|
||||
late double maxSize = list.last;
|
||||
double currentSize = Pref.defaultTextScale;
|
||||
|
||||
void setFontSize() {
|
||||
setting.put(SettingBoxKey.defaultTextScale, currentSize);
|
||||
GStorage.setting.put(SettingBoxKey.defaultTextScale, currentSize);
|
||||
Get
|
||||
..back(result: currentSize)
|
||||
..forceAppUpdate();
|
||||
|
||||
@@ -4,6 +4,8 @@ import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
||||
import 'package:PiliPlus/services/loggeer.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -21,7 +23,7 @@ class _LogsPageState extends State<LogsPage> {
|
||||
late String fileContent;
|
||||
List logsContent = [];
|
||||
DateTime? latestLog;
|
||||
late bool enableLog = GStorage.enableLog;
|
||||
late bool enableLog = Pref.enableLog;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
@@ -2,6 +2,8 @@ import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/pages/setting/widgets/switch_item.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show FilteringTextInputFormatter;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -16,10 +18,10 @@ class PlaySpeedPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
||||
late double playSpeedDefault;
|
||||
late double longPressSpeedDefault;
|
||||
late List<double> speedList;
|
||||
late bool enableAutoLongPressSpeed;
|
||||
late double playSpeedDefault = Pref.playSpeedDefault;
|
||||
late double longPressSpeedDefault = Pref.longPressSpeedDefault;
|
||||
late List<double> speedList = Pref.speedList;
|
||||
late bool enableAutoLongPressSpeed = Pref.enableAutoLongPressSpeed;
|
||||
List<({int id, String title, Icon icon})> sheetMenu = [
|
||||
(
|
||||
id: 1,
|
||||
@@ -47,22 +49,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
||||
),
|
||||
];
|
||||
|
||||
Box get video => GStorage.video;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// 默认倍速
|
||||
playSpeedDefault =
|
||||
video.get(VideoBoxKey.playSpeedDefault, defaultValue: 1.0);
|
||||
// 默认长按倍速
|
||||
longPressSpeedDefault =
|
||||
video.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 3.0);
|
||||
// 倍速
|
||||
speedList = GStorage.speedList;
|
||||
enableAutoLongPressSpeed = GStorage.setting
|
||||
.get(SettingBoxKey.enableAutoLongPressSpeed, defaultValue: false);
|
||||
}
|
||||
Box video = GStorage.video;
|
||||
|
||||
// 添加自定义倍速
|
||||
void onAddSpeed() {
|
||||
@@ -199,7 +186,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
await video.delete(VideoBoxKey.speedsList);
|
||||
speedList = GStorage.speedList;
|
||||
speedList = Pref.speedList;
|
||||
setState(() {});
|
||||
},
|
||||
child: const Text('重置'),
|
||||
|
||||
Reference in New Issue
Block a user