feat: search settings item

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-03 17:40:48 +08:00
parent 413a49bcb1
commit 18ee1d4e18
22 changed files with 2206 additions and 2308 deletions

View File

@@ -1,7 +1,6 @@
import 'package:PiliPalaX/models/common/nav_bar_config.dart';
import 'package:PiliPalaX/models/common/theme_type.dart';
import 'package:PiliPalaX/pages/home/index.dart';
import 'package:PiliPalaX/pages/setting/controller.dart';
import 'package:PiliPalaX/pages/setting/widgets/select_dialog.dart';
import 'package:flex_seed_scheme/flex_seed_scheme.dart';
import 'package:flutter/material.dart';
@@ -10,32 +9,6 @@ import 'package:hive/hive.dart';
import 'package:PiliPalaX/models/common/color_type.dart';
import 'package:PiliPalaX/utils/storage.dart';
// extension _SchemeExt on DynamicSchemeVariant {
// String get title => [
// '色调点', //tonalSpot
// '富达', //fidelity
// '单色', //monochrome
// '中性的', //neutral
// '充满活力', //vibrant
// '富有表现力', //expressive
// '内容', //content
// '彩虹', //rainbow
// '水果沙拉', //fruitSalad
// ][index];
// // from ImageToolbox
// String get subTitle => [
// '默认调色板样式,它允许自定义所有四种颜色,其他允许您仅设置关键颜色', //tonalSpot
// '与内容方案非常相似的方案', //fidelity
// '单色主题,颜色纯黑/白/灰', //monochrome
// '色彩比单色稍多的风格', //neutral
// '响亮的主题,主要调色板的色彩度最大,其他调色板的色彩度增加', //vibrant
// '有趣的主题 - 源颜色的色调不会出现在主题中', //expressive
// '将源颜色放置在Scheme.primaryContainer中的方案', //content
// '有趣的主题 - 源颜色的色调不会出现在主题中', //rainbow
// '有趣的主题 - 源颜色的色调不会出现在主题中', //fruitSalad
// ][index];
// }
class ColorSelectPage extends StatefulWidget {
const ColorSelectPage({super.key});
@@ -65,7 +38,6 @@ List<Item> generateItems(int count) {
}
class _ColorSelectPageState extends State<ColorSelectPage> {
final SettingController settingController = Get.put(SettingController());
final ColorSelectController ctr = Get.put(ColorSelectController());
FlexSchemeVariant _dynamicSchemeVariant =
FlexSchemeVariant.values[GStorage.schemeVariant];
@@ -88,14 +60,14 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
builder: (context) {
return SelectDialog<ThemeType>(
title: '主题模式',
value: settingController.themeType.value,
value: ctr.themeType.value,
values: ThemeType.values.map((e) {
return {'title': e.description, 'value': e};
}).toList());
},
);
if (result != null) {
settingController.themeType.value = result;
ctr.themeType.value = result;
GStorage.setting.put(SettingBoxKey.themeMode, result.index);
Get.forceAppUpdate();
}
@@ -106,8 +78,7 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
child: const Icon(Icons.flashlight_on_outlined),
),
title: Text('主题模式', style: titleStyle),
subtitle: Obx(() => Text(
'当前模式:${settingController.themeType.value.description}',
subtitle: Obx(() => Text('当前模式:${ctr.themeType.value.description}',
style: subTitleStyle)),
),
ListTile(
@@ -285,16 +256,15 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
class ColorSelectController extends GetxController {
RxBool dynamicColor = true.obs;
RxInt type = 0.obs;
late final List<Map<String, dynamic>> colorThemes;
late final List<Map<String, dynamic>> colorThemes = colorThemeTypes;
RxInt currentColor = 0.obs;
RxDouble currentTextScale = 1.0.obs;
Rx<ThemeType> themeType = GStorage.themeType.obs;
Box get setting => GStorage.setting;
@override
void onInit() {
colorThemes = colorThemeTypes;
// 默认使用动态取色
dynamicColor.value =
setting.get(SettingBoxKey.dynamicColor, defaultValue: true);
type.value = dynamicColor.value ? 0 : 1;

View File

@@ -217,13 +217,12 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
),
),
ListTile(
dense: false,
title: const Text('默认倍速'),
subtitle: Text(playSpeedDefault.toString()),
),
SetSwitchItem(
title: '动态长按倍速',
subTitle: '根据默认倍速长按时自动双倍',
subtitle: '根据默认倍速长按时自动双倍',
setKey: SettingBoxKey.enableAutoLongPressSpeed,
defaultVal: enableAutoLongPressSpeed,
onChanged: (val) {
@@ -237,7 +236,6 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
),
if (!enableAutoLongPressSpeed)
ListTile(
dense: false,
title: const Text('默认长按倍速'),
subtitle: Text(longPressSpeedDefault.toString()),
),