完善细类

This commit is contained in:
Developer
2026-03-31 07:56:35 +08:00
parent 66f72abab4
commit 9a58f6ca19
12 changed files with 683 additions and 257 deletions

View File

@@ -23,14 +23,16 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
bool _debugInfoEnabled = false;
bool _soundEnabled = false; // 默认关闭
bool _vibrationEnabled = true;
bool _darkModeEnabled = false;
bool _preloadEnabled = true;
bool _globalTipsEnabled = true; // 添加全局Tips开关状态
bool _hideSecondaryButtons = false; // 隐藏次要按钮
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
@override
void initState() {
@@ -48,6 +50,8 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
prefs.getBool(_globalTipsKey) ?? true; // 加载全局Tips开关状态
_preloadEnabled = prefs.getBool('preload_enabled') ?? true;
_soundEnabled = prefs.getBool(_soundEnabledKey) ?? false; // 加载声音反馈状态
_hideSecondaryButtons =
prefs.getBool(_hideSecondaryButtonsKey) ?? false; // 加载隐藏次要按钮状态
});
}
}
@@ -96,6 +100,65 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
}
}
// 设置震动反馈
Future<void> _setVibrationEnabled(bool value) async {
if (value && !_vibrationEnabled) {
// 从关闭到开启,显示提示对话框
_showVibrationDialog();
} else {
// 从开启到关闭,直接设置
if (mounted) {
setState(() {
_vibrationEnabled = value;
});
}
}
}
// 显示震动提示对话框
void _showVibrationDialog() {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('震动反馈'),
content: const Text('默认场景调用震动,未对软件震动做出优化,待收集建议改进'),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('取消'),
),
TextButton(
onPressed: () {
Navigator.of(context).pop();
if (mounted) {
setState(() {
_vibrationEnabled = true;
});
}
},
child: Text(
'确定',
style: TextStyle(color: AppConstants.primaryColor),
),
),
],
),
);
}
// 设置隐藏次要按钮
Future<void> _setHideSecondaryButtons(bool value) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setBool(_hideSecondaryButtonsKey, value);
// 更新管理器状态
await SecondaryButtonsManager().setHidden(value);
if (mounted) {
setState(() {
_hideSecondaryButtons = value;
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -145,14 +208,21 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
),
]),
const SizedBox(height: 16),
_buildSettingsGroup('显示设置', [
_buildSwitchItem(
_buildSettingsGroup('主页显示设置', [
_buildDevelopmentItem(
'Tap沉浸光感',
'开启后底栏显示类iOS26 风格\nbeta实验功能',
'开启后底栏显示类iOS26 风格',
Icons.dark_mode,
_darkModeEnabled,
(value) => setState(() => _darkModeEnabled = value),
),
_buildSwitchItem(
'隐藏次要按钮',
'开启后隐藏上一条和分享按钮',
Icons.share,
_hideSecondaryButtons,
_setHideSecondaryButtons,
),
_buildFontSliderItem(),
]),
const SizedBox(height: 16),
@@ -184,30 +254,30 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
'操作时震动提示',
Icons.vibration,
_vibrationEnabled,
(value) => setState(() => _vibrationEnabled = value),
(value) => _setVibrationEnabled(value),
),
]),
const SizedBox(height: 16),
_buildSettingsGroup('高级设置', [
_buildActionItem(
'Beta开关 关闭软件',
'开发者选项',
Icons.developer_mode,
() => _showSnackBar('调试模式开发中'),
),
// _buildActionItem(
// 'Beta开关 关闭软件',
// '开发者选项',
// Icons.developer_mode,
// () => _showSnackBar('调试模式开发中'),
// ),
_buildActionItem(
'重置设置',
'恢复默认设置',
Icons.restore,
() => _showResetDialog(),
),
_buildActionItem(
'调试模式',
'开发者选项',
Icons.developer_mode,
() => _showSnackBar('调试模式开发中'),
),
// _buildActionItem(
// '调试模式',
// '开发者选项',
// Icons.developer_mode,
// () => _showSnackBar('调试模式开发中'),
// ),
]),
const SizedBox(height: 32),
_buildVersionInfo(),
@@ -337,6 +407,46 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
);
}
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() {
return Container(
padding: const EdgeInsets.all(20),
@@ -399,7 +509,6 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
_soundEnabled = true;
_vibrationEnabled = true;
_globalTipsEnabled = true; // 重置全局Tips开关为开启
_darkModeEnabled = false;
});
_showSnackBar('已恢复默认设置');
},

View File

@@ -37,6 +37,8 @@ class LearnUsPage extends StatelessWidget {
const SizedBox(height: 16),
_buildOfficialSiteCard(),
const SizedBox(height: 16),
_buildQQGroupCard(context),
const SizedBox(height: 16),
_buildDeveloperCard(),
const SizedBox(height: 16),
_buildTeamCard(),
@@ -231,6 +233,120 @@ class LearnUsPage extends StatelessWidget {
);
}
Widget _buildQQGroupCard(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.05),
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(16),
child: Row(
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.blue.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
),
child: Icon(Icons.group, color: Colors.blue[700], size: 20),
),
const SizedBox(width: 12),
const Text(
'QQ交流群',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
],
),
),
const Divider(height: 1),
Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'加入我们的QQ交流群与其他诗词爱好者一起交流',
style: TextStyle(fontSize: 13, color: Colors.grey),
),
const SizedBox(height: 12),
InkWell(
onTap: () => _copyQQGroupNumber(context),
borderRadius: BorderRadius.circular(8),
child: Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey[50],
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: AppConstants.primaryColor.withValues(alpha: 0.3),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.content_copy,
size: 16,
color: AppConstants.primaryColor,
),
const SizedBox(width: 8),
Text(
'271129018',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: AppConstants.primaryColor,
),
),
],
),
),
),
const SizedBox(height: 8),
Text(
'💡 点击群号可复制',
style: TextStyle(fontSize: 12, color: Colors.grey[500]),
),
],
),
),
],
),
);
}
void _copyQQGroupNumber(BuildContext context) {
Clipboard.setData(const ClipboardData(text: '271129018'));
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Row(
children: [
Icon(Icons.check_circle, color: Colors.white, size: 20),
SizedBox(width: 8),
Text('QQ群号已复制到剪贴板'),
],
),
backgroundColor: AppConstants.primaryColor,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
duration: const Duration(seconds: 2),
),
);
}
Widget _buildDeveloperCard() {
return Container(
decoration: BoxDecoration(