关怀模式
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../constants/app_constants.dart';
|
||||
import '../../../models/colors/theme_colors.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
|
||||
/// 时间: 2026-03-27
|
||||
@@ -29,23 +30,10 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
late Timer _scrollTimer;
|
||||
|
||||
// 主题颜色选项
|
||||
final List<Color> _themeColors = [
|
||||
AppConstants.primaryColor, // 默认紫色
|
||||
Colors.blue, // 蓝色
|
||||
Colors.green, // 绿色
|
||||
Colors.orange, // 橙色
|
||||
Colors.red, // 红色
|
||||
Colors.teal, // 青色
|
||||
];
|
||||
final List<Color> _themeColors = ThemeColors.themeColors;
|
||||
|
||||
// 强调色选项
|
||||
final List<Color> _accentColors = [
|
||||
AppConstants.primaryColor, // 默认紫色
|
||||
Colors.yellow, // 黄色
|
||||
Colors.pink, // 粉色
|
||||
Colors.cyan, // 青色
|
||||
Colors.purple, // 深紫色
|
||||
];
|
||||
final List<Color> _accentColors = ThemeColors.accentColors;
|
||||
|
||||
// 字体大小选项
|
||||
final List<String> _fontSizes = ['小', '中', '大'];
|
||||
@@ -72,31 +60,68 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
final primaryColor = _themeController.currentThemeColor;
|
||||
final isDark = _themeController.isDarkMode;
|
||||
|
||||
return AlertDialog(
|
||||
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(Icons.construction, color: AppConstants.primaryColor),
|
||||
Icon(Icons.construction, color: primaryColor),
|
||||
const SizedBox(width: 8),
|
||||
const Text('开发中'),
|
||||
Text(
|
||||
'开发中',
|
||||
style: TextStyle(color: isDark ? Colors.white : Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
content: const Column(
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'个性化设置开发中',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
Text('• 当前仅支持设置深色模式'),
|
||||
Text('• 其他设置仅当前页面生效'),
|
||||
Text('• 后续版本将陆续支持'),
|
||||
Text('• 可提前预览主题风格设置'),
|
||||
SizedBox(height: 12),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'• ✅ 深色模式(已支持)',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[300] : Colors.black87,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'• ✅ 主题色彩(已支持)',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[300] : Colors.black87,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'• ⏳ 其他设置仅当前页面生效',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[300] : Colors.black87,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'• ⏳ 后续版本将陆续支持',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[300] : Colors.black87,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'感谢您的耐心等待!',
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -104,8 +129,11 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppConstants.primaryColor,
|
||||
backgroundColor: primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: const Text('我知道了'),
|
||||
),
|
||||
@@ -184,9 +212,11 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('个性化'),
|
||||
title: Text(
|
||||
'个性化',
|
||||
style: TextStyle(color: _themeController.currentThemeColor),
|
||||
),
|
||||
backgroundColor: isDark ? Colors.grey[900] : Colors.white,
|
||||
foregroundColor: isDark ? Colors.white : AppConstants.primaryColor,
|
||||
elevation: 0,
|
||||
),
|
||||
backgroundColor: isDark ? Colors.grey[900] : Colors.grey[50],
|
||||
@@ -363,7 +393,7 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
],
|
||||
),
|
||||
child: ListTile(
|
||||
leading: Icon(icon, color: _themeColors[themeColorIdx]),
|
||||
leading: Icon(icon, color: _themeController.currentThemeColor),
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
|
||||
@@ -371,7 +401,7 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
trailing: Switch(
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
activeThumbColor: _themeColors[themeColorIdx],
|
||||
activeThumbColor: _themeController.currentThemeColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -400,7 +430,7 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
],
|
||||
),
|
||||
child: ListTile(
|
||||
leading: Icon(icon, color: _themeColors[themeColorIdx]),
|
||||
leading: Icon(icon, color: _themeController.currentThemeColor),
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
|
||||
@@ -428,6 +458,22 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 颜色名称映射
|
||||
final Map<Color, String> _colorNames = {
|
||||
AppConstants.primaryColor: '紫韵',
|
||||
Colors.blue: '天蓝',
|
||||
Colors.green: '翠绿',
|
||||
Colors.orange: '橙光',
|
||||
Colors.red: '朱红',
|
||||
Colors.teal: '青碧',
|
||||
const Color(0xFF8B4513): '书褐',
|
||||
Colors.yellow: '明黄',
|
||||
Colors.pink: '桃粉',
|
||||
Colors.cyan: '湖青',
|
||||
Colors.purple: '罗兰',
|
||||
const Color(0xFFF5F5F0): '宣纸',
|
||||
};
|
||||
|
||||
Widget _buildColorSelector(
|
||||
String title,
|
||||
List<Color> colors,
|
||||
@@ -448,34 +494,103 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
|
||||
),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: colors.asMap().entries.map((entry) {
|
||||
return GestureDetector(
|
||||
onTap: () => onChanged(entry.key),
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: entry.value,
|
||||
shape: BoxShape.circle,
|
||||
border: entry.key == selectedIndex
|
||||
? Border.all(
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
width: 2,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.white : Colors.black87,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 80,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
itemCount: colors.length,
|
||||
itemBuilder: (context, index) {
|
||||
final color = colors[index];
|
||||
final colorName = _colorNames[color] ?? '色彩${index + 1}';
|
||||
final isSelected = index == selectedIndex;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => onChanged(index),
|
||||
child: Container(
|
||||
width: 60,
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
vertical: 8,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
shape: BoxShape.circle,
|
||||
border: isSelected
|
||||
? Border.all(
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
width: 3,
|
||||
)
|
||||
: Border.all(
|
||||
color: isDark
|
||||
? Colors.grey[600]!
|
||||
: Colors.grey[300]!,
|
||||
width: 1,
|
||||
),
|
||||
boxShadow: isSelected
|
||||
? [
|
||||
BoxShadow(
|
||||
color: color.withAlpha(128),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
]
|
||||
: null,
|
||||
),
|
||||
child: isSelected
|
||||
? Icon(
|
||||
Icons.check,
|
||||
color: color.computeLuminance() > 0.5
|
||||
? Colors.black
|
||||
: Colors.white,
|
||||
size: 24,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
colorName,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: isSelected
|
||||
? (isDark ? Colors.white : Colors.black)
|
||||
: (isDark
|
||||
? Colors.grey[400]
|
||||
: Colors.grey[600]),
|
||||
fontWeight: isSelected
|
||||
? FontWeight.w600
|
||||
: FontWeight.normal,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -543,7 +658,6 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
Icons.style,
|
||||
isMd: true,
|
||||
isDark: isDark,
|
||||
themeColorIdx: themeColorIdx,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildStyleChip(
|
||||
@@ -551,28 +665,24 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
Icons.auto_awesome,
|
||||
isMd: true,
|
||||
isDark: isDark,
|
||||
themeColorIdx: themeColorIdx,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildStyleChip(
|
||||
'透明毛玻璃',
|
||||
Icons.blur_on,
|
||||
isDark: isDark,
|
||||
themeColorIdx: themeColorIdx,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildStyleChip(
|
||||
'沉浸式渐变色',
|
||||
Icons.color_lens,
|
||||
isDark: isDark,
|
||||
themeColorIdx: themeColorIdx,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildStyleChip(
|
||||
'动态光感效果',
|
||||
Icons.lightbulb_outline,
|
||||
isDark: isDark,
|
||||
themeColorIdx: themeColorIdx,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
@@ -586,8 +696,8 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
_themeColors[themeColorIdx].withAlpha(10),
|
||||
_themeColors[themeColorIdx].withAlpha(5),
|
||||
_themeController.currentThemeColor.withAlpha(10),
|
||||
_themeController.currentThemeColor.withAlpha(5),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -597,7 +707,7 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
Icon(
|
||||
Icons.lightbulb_outline,
|
||||
size: 16,
|
||||
color: _themeColors[themeColorIdx],
|
||||
color: _themeController.currentThemeColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
@@ -625,10 +735,9 @@ class _AppDiyPageState extends State<AppDiyPage> {
|
||||
IconData icon, {
|
||||
bool isMd = false,
|
||||
required bool isDark,
|
||||
required int themeColorIdx,
|
||||
}) {
|
||||
final color = isMd
|
||||
? _themeColors[themeColorIdx]
|
||||
? _themeController.currentThemeColor
|
||||
: isDark
|
||||
? Colors.blue[400]!
|
||||
: Colors.blue[600]!;
|
||||
|
||||
Reference in New Issue
Block a user