mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: custom palette style
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -114,6 +114,8 @@ class MyApp extends StatelessWidget {
|
||||
// 字体缩放大小
|
||||
double textScale =
|
||||
setting.get(SettingBoxKey.defaultTextScale, defaultValue: 1.0);
|
||||
DynamicSchemeVariant dynamicSchemeVariant =
|
||||
DynamicSchemeVariant.values[GStorage.schemeVariant];
|
||||
|
||||
// 强制设置高帧率
|
||||
if (Platform.isAndroid) {
|
||||
@@ -144,12 +146,12 @@ class MyApp extends StatelessWidget {
|
||||
lightColorScheme = ColorScheme.fromSeed(
|
||||
seedColor: brandColor,
|
||||
brightness: Brightness.light,
|
||||
// dynamicSchemeVariant: DynamicSchemeVariant.neutral,
|
||||
dynamicSchemeVariant: dynamicSchemeVariant,
|
||||
);
|
||||
darkColorScheme = ColorScheme.fromSeed(
|
||||
seedColor: brandColor,
|
||||
brightness: Brightness.dark,
|
||||
// dynamicSchemeVariant: DynamicSchemeVariant.neutral,
|
||||
dynamicSchemeVariant: dynamicSchemeVariant,
|
||||
);
|
||||
}
|
||||
// 图片缓存
|
||||
|
||||
@@ -4,6 +4,32 @@ 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});
|
||||
|
||||
@@ -34,6 +60,8 @@ List<Item> generateItems(int count) {
|
||||
|
||||
class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
final ColorSelectController ctr = Get.put(ColorSelectController());
|
||||
DynamicSchemeVariant _dynamicSchemeVariant =
|
||||
DynamicSchemeVariant.values[GStorage.schemeVariant];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -44,6 +72,55 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
Builder(
|
||||
builder: (context) => ListTile(
|
||||
title: const Text('调色板风格'),
|
||||
leading: Container(
|
||||
width: 36,
|
||||
alignment: Alignment.center,
|
||||
child: Icon(Icons.palette_outlined),
|
||||
),
|
||||
subtitle: Text(
|
||||
_dynamicSchemeVariant.subTitle,
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
trailing: PopupMenuButton(
|
||||
initialValue: _dynamicSchemeVariant,
|
||||
onSelected: (item) async {
|
||||
_dynamicSchemeVariant = item;
|
||||
await GStorage.setting
|
||||
.put(SettingBoxKey.schemeVariant, item.index);
|
||||
(context as Element).markNeedsBuild();
|
||||
Get.forceAppUpdate();
|
||||
},
|
||||
itemBuilder: (context) => DynamicSchemeVariant.values
|
||||
.map((item) => PopupMenuItem<DynamicSchemeVariant>(
|
||||
value: item,
|
||||
child: Text(item.title),
|
||||
))
|
||||
.toList(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
_dynamicSchemeVariant.title,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 13,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
strutStyle: StrutStyle(leading: 0, height: 1),
|
||||
),
|
||||
Icon(
|
||||
size: 20,
|
||||
Icons.keyboard_arrow_right,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => RadioListTile(
|
||||
value: 0,
|
||||
|
||||
@@ -76,6 +76,9 @@ class GStorage {
|
||||
static int get dynamicPeriod =>
|
||||
setting.get(SettingBoxKey.dynamicPeriod, defaultValue: 5);
|
||||
|
||||
static int get schemeVariant =>
|
||||
setting.get(SettingBoxKey.schemeVariant, defaultValue: 0);
|
||||
|
||||
static ThemeMode get themeMode {
|
||||
switch (setting.get(SettingBoxKey.themeMode,
|
||||
defaultValue: ThemeType.system.code)) {
|
||||
@@ -259,6 +262,7 @@ class SettingBoxKey {
|
||||
previewQuality = 'previewQuality',
|
||||
checkDynamic = 'checkDynamic',
|
||||
dynamicPeriod = 'dynamicPeriod',
|
||||
schemeVariant = 'schemeVariant',
|
||||
|
||||
// 弹幕相关设置 权重(云屏蔽) 屏蔽类型 显示区域 透明度 字体大小 弹幕时间 描边粗细 字体粗细
|
||||
danmakuWeight = 'danmakuWeight',
|
||||
|
||||
Reference in New Issue
Block a user