深色模式、首页设置页面和功能优化

This commit is contained in:
Developer
2026-04-02 07:06:55 +08:00
parent f0a62ed68b
commit 954d173329
88 changed files with 12157 additions and 7578 deletions

View File

@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import '../../../constants/app_constants.dart';
import '../../../services/get/theme_controller.dart';
/// 时间: 2026-03-26
/// 功能: 隐私政策与软件协议页面
@@ -9,7 +11,8 @@ import '../../../constants/app_constants.dart';
/// 公共协议内容组件 - 隐私政策
class PrivacyPolicyContent extends StatelessWidget {
const PrivacyPolicyContent({super.key});
final bool isDark;
const PrivacyPolicyContent({super.key, this.isDark = false});
@override
Widget build(BuildContext context) {
@@ -87,10 +90,10 @@ class PrivacyPolicyContent extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 8),
child: Text(
title,
style: const TextStyle(
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
color: isDark ? Colors.white : Colors.black87,
),
),
);
@@ -101,10 +104,10 @@ class PrivacyPolicyContent extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 8),
child: Text(
title,
style: const TextStyle(
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black87,
color: isDark ? Colors.white : Colors.black87,
),
),
);
@@ -113,7 +116,11 @@ class PrivacyPolicyContent extends StatelessWidget {
Widget _buildParagraph(String text) {
return Text(
text,
style: TextStyle(fontSize: 14, color: Colors.grey[700], height: 1.6),
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.grey[300] : Colors.grey[700],
height: 1.6,
),
);
}
@@ -137,7 +144,7 @@ class PrivacyPolicyContent extends StatelessWidget {
text,
style: TextStyle(
fontSize: 14,
color: Colors.grey[700],
color: isDark ? Colors.grey[300] : Colors.grey[700],
height: 1.5,
),
),
@@ -152,19 +159,33 @@ class PrivacyPolicyContent extends StatelessWidget {
margin: const EdgeInsets.only(bottom: 12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white,
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey.withValues(alpha: 0.2)),
border: Border.all(
color: isDark
? Colors.grey[700]!.withValues(alpha: 0.2)
: Colors.grey.withValues(alpha: 0.2),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: isDark ? Colors.white : Colors.black,
),
),
const SizedBox(height: 4),
Text(desc, style: TextStyle(fontSize: 13, color: Colors.grey[600])),
Text(
desc,
style: TextStyle(
fontSize: 13,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
),
],
),
);
@@ -179,13 +200,20 @@ class PrivacyPolicyContent extends StatelessWidget {
width: 80,
child: Text(
'$label',
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: isDark ? Colors.white : Colors.black,
),
),
),
Expanded(
child: Text(
value,
style: TextStyle(fontSize: 14, color: Colors.grey[700]),
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.grey[300] : Colors.grey[700],
),
),
),
],
@@ -196,14 +224,20 @@ class PrivacyPolicyContent extends StatelessWidget {
Widget _buildUpdateDate(String date) {
return Text(
'更新日期:$date',
style: TextStyle(fontSize: 12, color: Colors.grey[500]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[500] : Colors.grey[500],
),
);
}
Widget _buildEffectiveDate(String date) {
return Text(
'生效日期:$date',
style: TextStyle(fontSize: 12, color: Colors.grey[500]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[500] : Colors.grey[500],
),
);
}
@@ -213,15 +247,26 @@ class PrivacyPolicyContent extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(width: 40, height: 1, color: Colors.grey[300]),
Container(
width: 40,
height: 1,
color: isDark ? Colors.grey[700] : Colors.grey[300],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
'到底了',
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[500] : Colors.grey[400],
),
),
),
Container(width: 40, height: 1, color: Colors.grey[300]),
Container(
width: 40,
height: 1,
color: isDark ? Colors.grey[700] : Colors.grey[300],
),
],
),
);
@@ -230,7 +275,8 @@ class PrivacyPolicyContent extends StatelessWidget {
/// 公共协议内容组件 - 用户协议
class UserAgreementContent extends StatelessWidget {
const UserAgreementContent({super.key});
final bool isDark;
const UserAgreementContent({super.key, this.isDark = false});
@override
Widget build(BuildContext context) {
@@ -320,10 +366,10 @@ class UserAgreementContent extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 8),
child: Text(
title,
style: const TextStyle(
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
color: isDark ? Colors.white : Colors.black87,
),
),
);
@@ -332,7 +378,11 @@ class UserAgreementContent extends StatelessWidget {
Widget _buildParagraph(String text) {
return Text(
text,
style: TextStyle(fontSize: 14, color: Colors.grey[700], height: 1.6),
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.grey[300] : Colors.grey[700],
height: 1.6,
),
);
}
@@ -345,13 +395,20 @@ class UserAgreementContent extends StatelessWidget {
width: 80,
child: Text(
'$label',
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: isDark ? Colors.white : Colors.black,
),
),
),
Expanded(
child: Text(
value,
style: TextStyle(fontSize: 14, color: Colors.grey[700]),
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.grey[300] : Colors.grey[700],
),
),
),
],
@@ -362,7 +419,10 @@ class UserAgreementContent extends StatelessWidget {
Widget _buildEffectiveDate(String date) {
return Text(
'生效日期:$date',
style: TextStyle(fontSize: 12, color: Colors.grey[500]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[500] : Colors.grey[500],
),
);
}
@@ -372,15 +432,26 @@ class UserAgreementContent extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(width: 40, height: 1, color: Colors.grey[300]),
Container(
width: 40,
height: 1,
color: isDark ? Colors.grey[700] : Colors.grey[300],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
'到底了',
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[500] : Colors.grey[400],
),
),
),
Container(width: 40, height: 1, color: Colors.grey[300]),
Container(
width: 40,
height: 1,
color: isDark ? Colors.grey[700] : Colors.grey[300],
),
],
),
);
@@ -398,6 +469,7 @@ class PrivacyPage extends StatefulWidget {
class _PrivacyPageState extends State<PrivacyPage>
with TickerProviderStateMixin {
late TabController _tabController;
final ThemeController _themeController = Get.find<ThemeController>();
@override
void initState() {
@@ -413,73 +485,93 @@ class _PrivacyPageState extends State<PrivacyPage>
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF5F5F5),
appBar: AppBar(
title: Text(
'隐私与协议',
style: TextStyle(
color: AppConstants.primaryColor,
fontWeight: FontWeight.bold,
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: Colors.white,
elevation: 0,
centerTitle: true,
bottom: TabBar(
controller: _tabController,
labelColor: AppConstants.primaryColor,
unselectedLabelColor: Colors.grey[600],
indicatorColor: AppConstants.primaryColor,
indicatorWeight: 2,
tabs: const [
Tab(text: '隐私政策'),
Tab(text: '用户协议'),
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
elevation: 0,
centerTitle: true,
bottom: TabBar(
controller: _tabController,
labelColor: AppConstants.primaryColor,
unselectedLabelColor: isDark ? Colors.grey[400] : Colors.grey[600],
indicatorColor: AppConstants.primaryColor,
indicatorWeight: 2,
tabs: const [
Tab(text: '隐私政策'),
Tab(text: '用户协议'),
],
),
leading: IconButton(
icon: Icon(Icons.arrow_back, color: AppConstants.primaryColor),
onPressed: () => Navigator.of(context).pop(),
),
actions: [
IconButton(
icon: Icon(Icons.link, color: AppConstants.primaryColor),
onPressed: () => _showOnlineLinkDialog(isDark),
tooltip: '在线版本',
),
],
),
leading: IconButton(
icon: Icon(Icons.arrow_back, color: AppConstants.primaryColor),
onPressed: () => Navigator.of(context).pop(),
body: TabBarView(
controller: _tabController,
children: [
PrivacyPolicyContent(isDark: isDark),
UserAgreementContent(isDark: isDark),
],
),
actions: [
IconButton(
icon: Icon(Icons.link, color: AppConstants.primaryColor),
onPressed: () => _showOnlineLinkDialog(),
tooltip: '在线版本',
),
],
),
body: TabBarView(
controller: _tabController,
children: const [PrivacyPolicyContent(), UserAgreementContent()],
),
);
);
});
}
void _showOnlineLinkDialog() {
void _showOnlineLinkDialog(bool isDark) {
showDialog(
context: context,
builder: (context) => AlertDialog(
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
title: Row(
children: [
Icon(Icons.public, color: AppConstants.primaryColor),
const SizedBox(width: 8),
const Text('在线版本'),
Text(
'在线版本',
style: TextStyle(color: isDark ? Colors.white : Colors.black),
),
],
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('您可以访问以下链接查看最新版本的协议:', style: TextStyle(fontSize: 14)),
Text(
'您可以访问以下链接查看最新版本的协议:',
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.grey[300] : Colors.black,
),
),
const SizedBox(height: 16),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey[100],
color: isDark ? const Color(0xFF3A3A3A) : Colors.grey[100],
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey[300]!),
border: Border.all(
color: isDark ? Colors.grey[700]! : Colors.grey[300]!,
),
),
child: SelectableText(
'https://poe.vogov.cn/privacy.html',
@@ -493,14 +585,20 @@ class _PrivacyPageState extends State<PrivacyPage>
const SizedBox(height: 12),
Text(
'💡 点击下方按钮复制链接,在浏览器中打开查看',
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('关闭'),
child: Text(
'关闭',
style: TextStyle(color: isDark ? Colors.grey[400] : null),
),
),
ElevatedButton.icon(
onPressed: () {