深色模式、首页设置页面和功能优化
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../../constants/app_constants.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
import '../../../services/get/tap_liquid_glass_controller.dart';
|
||||
import '../../../utils/audio_manager.dart';
|
||||
import './widgets.dart';
|
||||
import '../../home/home-load.dart';
|
||||
import '../../home/set/home-load.dart';
|
||||
import '../../../controllers/load/locally.dart';
|
||||
|
||||
/// 时间: 2026-03-26
|
||||
@@ -20,6 +23,10 @@ class AppFunSettingsPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
final ThemeController _themeController = Get.find<ThemeController>();
|
||||
final TapLiquidGlassController _glassController = Get.put(
|
||||
TapLiquidGlassController(),
|
||||
);
|
||||
bool _autoRefreshEnabled = false;
|
||||
bool _debugInfoEnabled = false;
|
||||
bool _soundEnabled = false; // 默认关闭
|
||||
@@ -30,7 +37,6 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
|
||||
static const String _autoRefreshKey = 'auto_refresh_enabled';
|
||||
static const String _debugInfoKey = 'debug_info_enabled';
|
||||
static const String _globalTipsKey = 'global_tips_enabled'; // 添加全局Tips开关key
|
||||
static const String _soundEnabledKey = 'sound_enabled'; // 声音反馈开关key
|
||||
static const String _hideSecondaryButtonsKey =
|
||||
'hide_secondary_buttons'; // 隐藏次要按钮key
|
||||
@@ -43,12 +49,13 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
|
||||
Future<void> _loadSettings() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await GlobalTipsManager().init();
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_autoRefreshEnabled = prefs.getBool(_autoRefreshKey) ?? false;
|
||||
_debugInfoEnabled = prefs.getBool(_debugInfoKey) ?? false;
|
||||
_globalTipsEnabled =
|
||||
prefs.getBool(_globalTipsKey) ?? true; // 加载全局Tips开关状态
|
||||
GlobalTipsManager().isEnabled; // 从 GlobalTipsManager 加载状态
|
||||
_preloadEnabled = prefs.getBool('preload_enabled') ?? true;
|
||||
_soundEnabled = prefs.getBool(_soundEnabledKey) ?? false; // 加载声音反馈状态
|
||||
_hideSecondaryButtons =
|
||||
@@ -160,141 +167,154 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF5F5F5),
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
'功能设置',
|
||||
style: TextStyle(
|
||||
color: AppConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: AppConstants.primaryColor),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_buildSettingsGroup('基础功能', [
|
||||
_buildSwitchItem(
|
||||
'自动刷新',
|
||||
'首页诗句自动刷新(5s) ',
|
||||
Icons.refresh,
|
||||
_autoRefreshEnabled,
|
||||
_setAutoRefresh,
|
||||
),
|
||||
_buildSwitchItem(
|
||||
'调式信息',
|
||||
'开启后可加载更多信息',
|
||||
Icons.bug_report,
|
||||
_debugInfoEnabled,
|
||||
_setDebugInfo,
|
||||
),
|
||||
_buildSwitchItem(
|
||||
'预加载',
|
||||
_preloadEnabled
|
||||
? '开启后 部分数据优先使用本地缓存,减少与服务器的通信次数'
|
||||
: '关闭后,优先使用云端数据,无延迟,但刷新缓慢',
|
||||
Icons.storage,
|
||||
_preloadEnabled,
|
||||
_setPreload,
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 16),
|
||||
_buildSettingsGroup('主页显示设置', [
|
||||
_buildDevelopmentItem(
|
||||
'Tap沉浸光感',
|
||||
'开启后底栏显示类iOS26 风格',
|
||||
Icons.dark_mode,
|
||||
),
|
||||
|
||||
_buildSwitchItem(
|
||||
'隐藏次要按钮',
|
||||
'开启后隐藏上一条和分享按钮',
|
||||
Icons.share,
|
||||
_hideSecondaryButtons,
|
||||
_setHideSecondaryButtons,
|
||||
),
|
||||
|
||||
_buildFontSliderItem(),
|
||||
]),
|
||||
const SizedBox(height: 16),
|
||||
_buildSettingsGroup('交互反馈', [
|
||||
_buildSwitchItem(
|
||||
'全局Tips开关',
|
||||
'显示一些使用技巧',
|
||||
Icons.volume_up,
|
||||
_globalTipsEnabled,
|
||||
(value) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setBool(_globalTipsKey, value);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_globalTipsEnabled = value;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
_buildSwitchItem(
|
||||
'声音反馈',
|
||||
'操作时播放提示音',
|
||||
Icons.volume_up,
|
||||
_soundEnabled,
|
||||
_setSoundEnabled,
|
||||
),
|
||||
_buildSwitchItem(
|
||||
'震动反馈',
|
||||
'操作时震动提示',
|
||||
Icons.vibration,
|
||||
_vibrationEnabled,
|
||||
(value) => _setVibrationEnabled(value),
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
_buildSettingsGroup('高级设置', [
|
||||
// _buildActionItem(
|
||||
// 'Beta开关 关闭软件',
|
||||
// '开发者选项',
|
||||
// Icons.developer_mode,
|
||||
// () => _showSnackBar('调试模式开发中'),
|
||||
// ),
|
||||
_buildActionItem(
|
||||
'重置设置',
|
||||
'恢复默认设置',
|
||||
Icons.restore,
|
||||
() => _showResetDialog(),
|
||||
),
|
||||
// _buildActionItem(
|
||||
// '调试模式',
|
||||
// '开发者选项',
|
||||
// Icons.developer_mode,
|
||||
// () => _showSnackBar('调试模式开发中'),
|
||||
// ),
|
||||
]),
|
||||
const SizedBox(height: 32),
|
||||
_buildVersionInfo(),
|
||||
],
|
||||
),
|
||||
);
|
||||
// 设置Tap沉浸光感导航栏
|
||||
Future<void> _setTapLiquidGlass(bool value) async {
|
||||
await _glassController.toggleEnabled(value);
|
||||
}
|
||||
|
||||
Widget _buildSettingsGroup(String title, List<Widget> items) {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() {
|
||||
final isDark = _themeController.isDarkMode;
|
||||
return Scaffold(
|
||||
backgroundColor: isDark
|
||||
? const Color(0xFF1A1A1A)
|
||||
: const Color(0xFFF5F5F5),
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
'功能设置',
|
||||
style: TextStyle(
|
||||
color: AppConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: AppConstants.primaryColor),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_buildSettingsGroup('基础功能', [
|
||||
_buildSwitchItem(
|
||||
'自动刷新',
|
||||
'首页诗句自动刷新(5s) ',
|
||||
Icons.refresh,
|
||||
_autoRefreshEnabled,
|
||||
_setAutoRefresh,
|
||||
isDark,
|
||||
),
|
||||
_buildSwitchItem(
|
||||
'调式信息',
|
||||
'开启后可加载更多信息',
|
||||
Icons.bug_report,
|
||||
_debugInfoEnabled,
|
||||
_setDebugInfo,
|
||||
isDark,
|
||||
),
|
||||
_buildSwitchItem(
|
||||
'预加载',
|
||||
_preloadEnabled
|
||||
? '开启后 部分数据优先使用本地缓存,减少与服务器的通信次数'
|
||||
: '关闭后,优先使用云端数据,无延迟,但刷新缓慢',
|
||||
Icons.storage,
|
||||
_preloadEnabled,
|
||||
_setPreload,
|
||||
isDark,
|
||||
),
|
||||
], isDark),
|
||||
const SizedBox(height: 16),
|
||||
_buildSettingsGroup('主页显示设置', [
|
||||
Obx(
|
||||
() => _buildSwitchItem(
|
||||
'Tap沉浸光感',
|
||||
'开启后底栏显示类iOS26 风格',
|
||||
Icons.dark_mode,
|
||||
_glassController.isEnabled,
|
||||
_setTapLiquidGlass,
|
||||
isDark,
|
||||
),
|
||||
),
|
||||
Obx(() {
|
||||
if (!_glassController.isEnabled) return const SizedBox.shrink();
|
||||
return _buildTransparencyLevelItem(isDark);
|
||||
}),
|
||||
_buildSwitchItem(
|
||||
'隐藏次要按钮',
|
||||
'开启后隐藏上一条和分享按钮',
|
||||
Icons.share,
|
||||
_hideSecondaryButtons,
|
||||
_setHideSecondaryButtons,
|
||||
isDark,
|
||||
),
|
||||
|
||||
_buildFontSliderItem(isDark),
|
||||
], isDark),
|
||||
const SizedBox(height: 16),
|
||||
_buildSettingsGroup('交互反馈', [
|
||||
_buildSwitchItem(
|
||||
'全局Tips开关',
|
||||
'显示一些使用技巧',
|
||||
Icons.volume_up,
|
||||
_globalTipsEnabled,
|
||||
(value) async {
|
||||
await GlobalTipsManager().setEnabled(value);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_globalTipsEnabled = value;
|
||||
});
|
||||
}
|
||||
},
|
||||
isDark,
|
||||
),
|
||||
_buildSwitchItem(
|
||||
'声音反馈',
|
||||
'操作时播放提示音',
|
||||
Icons.volume_up,
|
||||
_soundEnabled,
|
||||
_setSoundEnabled,
|
||||
isDark,
|
||||
),
|
||||
_buildSwitchItem(
|
||||
'震动反馈',
|
||||
'操作时震动提示',
|
||||
Icons.vibration,
|
||||
_vibrationEnabled,
|
||||
(value) => _setVibrationEnabled(value),
|
||||
isDark,
|
||||
),
|
||||
], isDark),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
_buildSettingsGroup('高级设置', [
|
||||
_buildActionItem(
|
||||
'重置设置',
|
||||
'恢复默认设置',
|
||||
Icons.restore,
|
||||
() => _showResetDialog(),
|
||||
isDark,
|
||||
),
|
||||
], isDark),
|
||||
const SizedBox(height: 32),
|
||||
_buildVersionInfo(isDark),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildSettingsGroup(String title, List<Widget> items, bool isDark) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -326,6 +346,7 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
IconData icon,
|
||||
bool value,
|
||||
ValueChanged<bool> onChanged,
|
||||
bool isDark,
|
||||
) {
|
||||
return ListTile(
|
||||
leading: Container(
|
||||
@@ -338,11 +359,18 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
),
|
||||
title: Text(
|
||||
title,
|
||||
style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500),
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
subtitle,
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
trailing: Switch(
|
||||
value: value,
|
||||
@@ -352,7 +380,7 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFontSliderItem() {
|
||||
Widget _buildFontSliderItem(bool isDark) {
|
||||
return ListTile(
|
||||
leading: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@@ -362,43 +390,81 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
),
|
||||
child: Icon(Icons.widgets, color: AppConstants.primaryColor, size: 20),
|
||||
),
|
||||
title: const Text(
|
||||
title: Text(
|
||||
'桌面卡片',
|
||||
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500),
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'使用帮助',
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
trailing: Icon(
|
||||
Icons.chevron_right,
|
||||
color: isDark ? Colors.grey[500] : Colors.grey[400],
|
||||
),
|
||||
trailing: Icon(Icons.chevron_right, color: Colors.grey[400]),
|
||||
onTap: () {
|
||||
// 显示对话框提示鸿蒙设备设置方法
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline, color: AppConstants.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),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text('1. 长按桌面空白处'),
|
||||
Text('2. 选择「情景诗词」卡片'),
|
||||
Text('3. 添加后点击桌面卡片即可设置'),
|
||||
Text('4. 后续版本支持在应用内设置卡片'),
|
||||
SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'1. 长按桌面空白处',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[300] : Colors.black,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'2. 选择「情景诗词」卡片',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[300] : Colors.black,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'3. 添加后点击桌面卡片即可设置',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[300] : Colors.black,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'4. 后续版本支持在应用内设置卡片',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[300] : Colors.black,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const Text(
|
||||
'注意:该页面设置对鸿蒙设备不生效',
|
||||
style: TextStyle(color: Colors.orange, fontSize: 12),
|
||||
),
|
||||
@@ -408,7 +474,6 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
// 返回桌面
|
||||
SystemNavigator.pop();
|
||||
},
|
||||
child: const Text('前往桌面'),
|
||||
@@ -437,11 +502,116 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTransparencyLevelItem(bool isDark) {
|
||||
return Obx(() {
|
||||
final currentIndex = _glassController.transparencyLevelIndex;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.opacity,
|
||||
color: AppConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'高透级别',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'当前: ${_glassController.transparencyLevelLabel}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildLevelButton('弱', 0, currentIndex == 0, isDark),
|
||||
const SizedBox(width: 8),
|
||||
_buildLevelButton('中', 1, currentIndex == 1, isDark),
|
||||
const SizedBox(width: 8),
|
||||
_buildLevelButton('强', 2, currentIndex == 2, isDark),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildLevelButton(
|
||||
String label,
|
||||
int levelIndex,
|
||||
bool isSelected,
|
||||
bool isDark,
|
||||
) {
|
||||
return Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => _glassController.setTransparencyLevelByIndex(levelIndex),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? AppConstants.primaryColor
|
||||
: (isDark ? Colors.grey[800] : Colors.grey[200]),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? AppConstants.primaryColor
|
||||
: (isDark ? Colors.grey[700]! : Colors.grey[300]!),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: (isDark ? Colors.grey[300] : Colors.grey[700]),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActionItem(
|
||||
String title,
|
||||
String subtitle,
|
||||
IconData icon,
|
||||
VoidCallback onTap,
|
||||
bool isDark,
|
||||
) {
|
||||
return ListTile(
|
||||
leading: Container(
|
||||
@@ -454,66 +624,36 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
),
|
||||
title: Text(
|
||||
title,
|
||||
style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500),
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
subtitle,
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
trailing: Icon(
|
||||
Icons.chevron_right,
|
||||
color: isDark ? Colors.grey[500] : Colors.grey[400],
|
||||
),
|
||||
trailing: Icon(Icons.chevron_right, color: Colors.grey[400]),
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDevelopmentItem(String title, String subtitle, IconData icon) {
|
||||
return ListTile(
|
||||
leading: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(icon, color: Colors.grey, size: 20),
|
||||
),
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
subtitle,
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
|
||||
),
|
||||
trailing: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'开发中',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.grey[600],
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildVersionInfo() {
|
||||
Widget _buildVersionInfo(bool isDark) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -529,12 +669,19 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
AppConstants.appName,
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'版本 ${AppConstants.appVersion}',
|
||||
style: TextStyle(fontSize: 13, color: Colors.grey[600]),
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -567,9 +714,9 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
await _setPreload(true); // 预加载:开启
|
||||
await _setHideSecondaryButtons(false); // 隐藏次要按钮:关闭
|
||||
await _setSoundEnabled(false); // 声音反馈:关闭
|
||||
await _setTapLiquidGlass(true); // Tap沉浸光感:开启
|
||||
// 全局Tips:开启
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setBool(_globalTipsKey, true);
|
||||
await GlobalTipsManager().setEnabled(true);
|
||||
// 震动反馈:开启(不需要保存到SharedPreferences,直接更新状态)
|
||||
setState(() {
|
||||
_vibrationEnabled = true;
|
||||
@@ -590,4 +737,5 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
|
||||
// - 隐藏次要按钮:关闭
|
||||
// - 声音反馈:关闭
|
||||
// - 震动反馈:开启
|
||||
// - 全局Tips:开启
|
||||
// - 全局Tips:开启
|
||||
// - tap 沉浸:开启
|
||||
Reference in New Issue
Block a user