深色模式、首页设置页面和功能优化
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../../constants/app_constants.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
|
||||
/// 时间: 2026-03-26
|
||||
/// 功能: 用户体验计划页面
|
||||
@@ -15,6 +17,7 @@ class UserPlanPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _UserPlanPageState extends State<UserPlanPage> {
|
||||
final ThemeController _themeController = Get.find<ThemeController>();
|
||||
bool _isJoined = false;
|
||||
bool _isLoading = true;
|
||||
|
||||
@@ -187,46 +190,51 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
|
||||
@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: 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(),
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: AppConstants.primaryColor),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: _isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_buildStatusCard(),
|
||||
const SizedBox(height: 16),
|
||||
_buildCollectInfoSection(),
|
||||
const SizedBox(height: 16),
|
||||
_buildBenefitsSection(),
|
||||
const SizedBox(height: 16),
|
||||
_buildPrivacyNotice(),
|
||||
const SizedBox(height: 24),
|
||||
_buildActionButton(),
|
||||
const SizedBox(height: 16),
|
||||
_buildBottomIndicator(),
|
||||
],
|
||||
),
|
||||
);
|
||||
body: _isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_buildStatusCard(isDark),
|
||||
const SizedBox(height: 16),
|
||||
_buildCollectInfoSection(isDark),
|
||||
const SizedBox(height: 16),
|
||||
_buildBenefitsSection(isDark),
|
||||
const SizedBox(height: 16),
|
||||
_buildPrivacyNotice(isDark),
|
||||
const SizedBox(height: 24),
|
||||
_buildActionButton(isDark),
|
||||
const SizedBox(height: 16),
|
||||
_buildBottomIndicator(isDark),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildStatusCard() {
|
||||
Widget _buildStatusCard(bool isDark) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
@@ -299,14 +307,14 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCollectInfoSection() {
|
||||
Widget _buildCollectInfoSection(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),
|
||||
),
|
||||
@@ -332,26 +340,32 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Text(
|
||||
Text(
|
||||
'收集的信息',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_buildInfoItem(Icons.timer, '软件使用时长', '统计每日使用时长及时段'),
|
||||
_buildInfoItem(Icons.visibility, '不同页面停留时间', '了解用户关注的页面'),
|
||||
_buildInfoItem(Icons.favorite, '个人喜爱诗词', '推荐更精准的内容'),
|
||||
_buildInfoItem(Icons.error, '错误信息', '优化软件功能体验'),
|
||||
_buildInfoItem(Icons.location_on, 'IP归属地', '群体用户画像生成分析'),
|
||||
_buildInfoItem(Icons.devices, '设备信息', '适配更多设备型号'),
|
||||
_buildInfoItem(Icons.timer, '软件使用时长', '统计每日使用时长及时段', isDark),
|
||||
_buildInfoItem(Icons.visibility, '不同页面停留时间', '了解用户关注的页面', isDark),
|
||||
_buildInfoItem(Icons.favorite, '个人喜爱诗词', '推荐更精准的内容', isDark),
|
||||
_buildInfoItem(Icons.error, '错误信息', '优化软件功能体验', isDark),
|
||||
_buildInfoItem(Icons.location_on, 'IP归属地', '群体用户画像生成分析', isDark),
|
||||
_buildInfoItem(Icons.devices, '设备信息', '适配更多设备型号', isDark),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue.withValues(alpha: 0.05),
|
||||
color: isDark
|
||||
? Colors.blue.withValues(alpha: 0.15)
|
||||
: Colors.blue.withValues(alpha: 0.05),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
@@ -373,12 +387,21 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoItem(IconData icon, String title, String subtitle) {
|
||||
Widget _buildInfoItem(
|
||||
IconData icon,
|
||||
String title,
|
||||
String subtitle,
|
||||
bool isDark,
|
||||
) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, size: 20, color: Colors.grey[600]),
|
||||
Icon(
|
||||
icon,
|
||||
size: 20,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -386,15 +409,19 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
subtitle,
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[500]),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[500],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -404,7 +431,7 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBenefitsSection() {
|
||||
Widget _buildBenefitsSection(bool isDark) {
|
||||
final benefits = [
|
||||
{'icon': Icons.how_to_vote, 'title': '参与投票', 'desc': '对产品功能进行投票'},
|
||||
{'icon': Icons.bar_chart, 'title': '查看统计数据', 'desc': '查看全站使用统计'},
|
||||
@@ -416,11 +443,11 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
|
||||
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),
|
||||
),
|
||||
@@ -450,11 +477,12 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
'加入后的权益',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
@@ -464,7 +492,9 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
'体验更多受限制的功能',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Colors.grey[500],
|
||||
color: isDark
|
||||
? Colors.grey[400]
|
||||
: Colors.grey[500],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
@@ -473,7 +503,9 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
child: Icon(
|
||||
Icons.info_outline,
|
||||
size: 14,
|
||||
color: Colors.grey[500],
|
||||
color: isDark
|
||||
? Colors.grey[400]
|
||||
: Colors.grey[500],
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -502,10 +534,12 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[50],
|
||||
color: isDark ? Colors.grey[800] : Colors.grey[50],
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: Colors.grey.withValues(alpha: 0.2),
|
||||
color: isDark
|
||||
? Colors.grey[700]!
|
||||
: Colors.grey.withValues(alpha: 0.2),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
@@ -523,16 +557,19 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
children: [
|
||||
Text(
|
||||
benefit['title'] as String,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
benefit['desc'] as String,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: Colors.grey[500],
|
||||
color: isDark
|
||||
? Colors.grey[400]
|
||||
: Colors.grey[500],
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -549,15 +586,15 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPrivacyNotice() {
|
||||
Widget _buildPrivacyNotice(bool isDark) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
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),
|
||||
),
|
||||
@@ -581,23 +618,27 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Text(
|
||||
Text(
|
||||
'隐私保护说明',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isDark ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildPrivacyItem('🔒 数据匿名化处理,无法追溯到个人'),
|
||||
_buildPrivacyItem('🛡️ 数据仅用于产品改进,不会出售'),
|
||||
_buildPrivacyItem('📋 您可以随时退出计划'),
|
||||
_buildPrivacyItem('🗑️ 部分数据将被删除'),
|
||||
_buildPrivacyItem('🔒 数据匿名化处理,无法追溯到个人', isDark),
|
||||
_buildPrivacyItem('🛡️ 数据仅用于产品改进,不会出售', isDark),
|
||||
_buildPrivacyItem('📋 您可以随时退出计划', isDark),
|
||||
_buildPrivacyItem('🗑️ 部分数据将被删除', isDark),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPrivacyItem(String text) {
|
||||
Widget _buildPrivacyItem(String text, bool isDark) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
child: Row(
|
||||
@@ -608,7 +649,7 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.grey[700],
|
||||
color: isDark ? Colors.grey[300] : Colors.grey[700],
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
@@ -618,7 +659,7 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActionButton() {
|
||||
Widget _buildActionButton(bool isDark) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
@@ -631,7 +672,9 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
AppConstants.primaryColor.withBlue(180),
|
||||
],
|
||||
),
|
||||
color: _isJoined ? Colors.grey[300] : null,
|
||||
color: _isJoined
|
||||
? (isDark ? Colors.grey[700] : Colors.grey[300])
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: _isJoined
|
||||
? null
|
||||
@@ -663,7 +706,9 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
children: [
|
||||
Icon(
|
||||
_isJoined ? Icons.exit_to_app : Icons.volunteer_activism,
|
||||
color: _isJoined ? Colors.grey[600] : Colors.white,
|
||||
color: _isJoined
|
||||
? (isDark ? Colors.grey[300] : Colors.grey[600])
|
||||
: Colors.white,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
@@ -671,7 +716,9 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: _isJoined ? Colors.grey[600] : Colors.white,
|
||||
color: _isJoined
|
||||
? (isDark ? Colors.grey[300] : Colors.grey[600])
|
||||
: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -680,21 +727,32 @@ class _UserPlanPageState extends State<UserPlanPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomIndicator() {
|
||||
Widget _buildBottomIndicator(bool isDark) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||
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],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user