关怀模式

This commit is contained in:
Developer
2026-04-02 22:30:49 +08:00
parent 09fee0694c
commit 7872f2e78a
70 changed files with 4884 additions and 2752 deletions

View File

@@ -12,6 +12,7 @@ import 'package:get/get.dart';
import '../../constants/app_constants.dart';
import '../../config/app_config.dart';
import '../../models/colors/theme_colors.dart';
import 'history_page.dart';
import 'per_card.dart';
import 'settings/app_fun.dart';
@@ -43,13 +44,14 @@ class ProfilePage extends StatelessWidget {
return Obx(() {
final isDark = themeController.isDarkMode;
final primaryColor = themeController.currentThemeColor;
return GetBuilder<ProfileController>(
builder: (controller) {
return Scaffold(
backgroundColor: isDark
? const Color(0xFF1A1A1A)
: const Color(0xFFF5F5F5),
appBar: _buildAppBar(controller, isDark),
appBar: _buildAppBar(controller, isDark, primaryColor),
body: GestureDetector(
behavior: HitTestBehavior.opaque,
onVerticalDragStart: (details) {
@@ -77,9 +79,9 @@ class ProfilePage extends StatelessWidget {
controller: pageController,
onPageChanged: controller.onPageChanged,
children: [
_buildPage1(controller, isDark),
_buildPage2(controller, isDark),
_buildPage3(controller, isDark),
_buildPage1(controller, isDark, primaryColor),
_buildPage2(controller, isDark, primaryColor),
_buildPage3(controller, isDark, primaryColor),
],
),
),
@@ -92,21 +94,22 @@ class ProfilePage extends StatelessWidget {
});
}
PreferredSizeWidget _buildAppBar(ProfileController controller, bool isDark) {
PreferredSizeWidget _buildAppBar(
ProfileController controller,
bool isDark,
Color primaryColor,
) {
return AppBar(
title: Text(
'个人',
style: TextStyle(
color: AppConstants.primaryColor,
fontWeight: FontWeight.bold,
),
style: TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
),
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
elevation: 0,
centerTitle: true,
actions: [
IconButton(
icon: Icon(Icons.more_horiz, color: AppConstants.primaryColor),
icon: Icon(Icons.more_horiz, color: primaryColor),
onPressed: () => _showMoreOptions(controller),
),
],
@@ -141,7 +144,11 @@ class ProfilePage extends StatelessWidget {
);
}
Widget _buildPage1(ProfileController controller, bool isDark) {
Widget _buildPage1(
ProfileController controller,
bool isDark,
Color primaryColor,
) {
return SingleChildScrollView(
// 添加底部内边距,让内容延伸到导航栏下方,实现玻璃效果
padding: EdgeInsets.only(
@@ -175,14 +182,14 @@ class ProfilePage extends StatelessWidget {
children: [
Icon(
Icons.analytics_outlined,
color: AppConstants.primaryColor,
color: primaryColor,
size: 20,
),
const SizedBox(width: 8),
Text(
'诗词挑战',
style: TextStyle(
color: AppConstants.primaryColor,
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.bold,
),
@@ -199,16 +206,19 @@ class ProfilePage extends StatelessWidget {
'今日答题',
'${controller.todayQuestions.value}',
isDark,
primaryColor,
),
_buildInteractionItem(
'本周答题',
'${controller.weekQuestions.value}',
isDark,
primaryColor,
),
_buildInteractionItem(
'答对次数',
'${controller.correctAnswers.value}',
isDark,
primaryColor,
),
],
);
@@ -235,7 +245,7 @@ class ProfilePage extends StatelessWidget {
Get.to(const PoetryLevelPage());
},
style: ElevatedButton.styleFrom(
backgroundColor: AppConstants.primaryColor,
backgroundColor: primaryColor,
padding: const EdgeInsets.symmetric(vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
@@ -272,16 +282,12 @@ class ProfilePage extends StatelessWidget {
children: [
Row(
children: [
Icon(
Icons.person_outline,
color: AppConstants.primaryColor,
size: 20,
),
Icon(Icons.person_outline, color: primaryColor, size: 20),
const SizedBox(width: 8),
Text(
'统计',
style: TextStyle(
color: AppConstants.primaryColor,
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.bold,
),
@@ -350,7 +356,11 @@ class ProfilePage extends StatelessWidget {
);
}
Widget _buildPage2(ProfileController controller, bool isDark) {
Widget _buildPage2(
ProfileController controller,
bool isDark,
Color primaryColor,
) {
return ListView(
// 添加底部内边距,让内容延伸到导航栏下方,实现玻璃效果
padding: EdgeInsets.only(
@@ -360,80 +370,109 @@ class ProfilePage extends StatelessWidget {
bottom: AppConfig.liquidGlassTotalHeight + 16,
),
children: [
_buildSettingsGroup('软件设置', [
_buildSettingsItem(
'功能设置',
Icons.verified_user,
() => Get.to(const AppFunSettingsPage()),
isDark,
),
_buildSettingsItem(
'离线使用',
Icons.volunteer_activism,
() => Get.to(const OfflineDataPage()),
isDark,
),
_buildSettingsItem(
'历史记录',
Icons.history,
() => Get.to(const HistoryPage()),
isDark,
),
_buildSettingsItem(
'主题风格',
Icons.palette,
() => Get.to(const AppDiyPage()),
isDark,
),
], isDark),
_buildSettingsGroup(
'软件设置',
[
_buildSettingsItem(
'功能设置',
Icons.verified_user,
() => Get.to(const AppFunSettingsPage()),
isDark,
primaryColor,
),
_buildSettingsItem(
'离线使用',
Icons.volunteer_activism,
() => Get.to(const OfflineDataPage()),
isDark,
primaryColor,
),
_buildSettingsItem(
'历史记录',
Icons.history,
() => Get.to(const HistoryPage()),
isDark,
primaryColor,
),
_buildSettingsItem(
'主题风格',
Icons.palette,
() => Get.to(const AppDiyPage()),
isDark,
primaryColor,
),
],
isDark,
primaryColor,
),
const SizedBox(height: 16),
_buildSettingsGroup('隐私设置', [
_buildSettingsItem(
'权限管理',
Icons.block,
() => Get.to(const PermissionPage()),
isDark,
),
_buildSettingsItem(
'应用数据',
Icons.security,
() => Get.to(const AppDataPage()),
isDark,
),
_buildSettingsItem(
'软件协议',
Icons.description,
() => Get.to(const PrivacyPage()),
isDark,
),
], isDark),
_buildSettingsGroup(
'隐私设置',
[
_buildSettingsItem(
'权限管理',
Icons.block,
() => Get.to(const PermissionPage()),
isDark,
primaryColor,
),
_buildSettingsItem(
'应用数据',
Icons.security,
() => Get.to(const AppDataPage()),
isDark,
primaryColor,
),
_buildSettingsItem(
'软件协议',
Icons.description,
() => Get.to(const PrivacyPage()),
isDark,
primaryColor,
),
],
isDark,
primaryColor,
),
const SizedBox(height: 16),
_buildSettingsGroup('软件信息', [
_buildSettingsItem(
'应用信息',
Icons.phone_android,
() => Get.to(const AppInfoPage()),
isDark,
),
_buildSettingsItem(
'了解我们',
Icons.info,
() => Get.to(const LearnUsPage()),
isDark,
),
_buildSettingsItem(
'已知bug',
Icons.cleaning_services,
() => showBugListBottomSheet(Get.context!),
isDark,
),
_buildScreenWakeItem(controller, isDark),
], isDark),
_buildSettingsGroup(
'软件信息',
[
_buildSettingsItem(
'应用信息',
Icons.phone_android,
() => Get.to(const AppInfoPage()),
isDark,
primaryColor,
),
_buildSettingsItem(
'了解我们',
Icons.info,
() => Get.to(const LearnUsPage()),
isDark,
primaryColor,
),
_buildSettingsItem(
'已知bug',
Icons.cleaning_services,
() => showBugListBottomSheet(Get.context!),
isDark,
primaryColor,
),
_buildScreenWakeItem(controller, isDark, primaryColor),
],
isDark,
primaryColor,
),
],
);
}
Widget _buildPage3(ProfileController controller, bool isDark) {
Widget _buildPage3(
ProfileController controller,
bool isDark,
Color primaryColor,
) {
return ListView(
// 添加底部内边距,让内容延伸到导航栏下方,实现玻璃效果
padding: EdgeInsets.only(
@@ -443,38 +482,48 @@ class ProfilePage extends StatelessWidget {
bottom: AppConfig.liquidGlassTotalHeight + 16,
),
children: [
_buildSettingsGroup('用户体验计划(限免)', [
_buildSettingsItem(
'加入体验',
Icons.edit,
() => Get.to(const UserPlanPage()),
isDark,
),
_buildSettingsItem(
'参与投票',
Icons.how_to_vote,
() => Get.to(const VotePage()),
isDark,
),
_buildSettingsItem(
'查看全站统计',
Icons.history,
() => Get.to(const EntirePage()),
isDark,
),
_buildSettingsItem(
'开发计划',
Icons.analytics,
() => controller.showSnackBar('首个上线版本暂无计划,待收集整理用户建议'),
isDark,
),
_buildSettingsItem(
'去投稿',
Icons.edit_note,
() => Get.to(const ManuscriptPage()),
isDark,
),
], isDark),
_buildSettingsGroup(
'用户体验计划(限免)',
[
_buildSettingsItem(
'加入体验',
Icons.edit,
() => Get.to(const UserPlanPage()),
isDark,
primaryColor,
),
_buildSettingsItem(
'参与投票',
Icons.how_to_vote,
() => Get.to(const VotePage()),
isDark,
primaryColor,
),
_buildSettingsItem(
'查看全站统计',
Icons.history,
() => Get.to(const EntirePage()),
isDark,
primaryColor,
),
_buildSettingsItem(
'开发计划',
Icons.analytics,
() => controller.showSnackBar('首个上线版本暂无计划,待收集整理用户建议'),
isDark,
primaryColor,
),
_buildSettingsItem(
'去投稿',
Icons.edit_note,
() => Get.to(const ManuscriptPage()),
isDark,
primaryColor,
),
],
isDark,
primaryColor,
),
const SizedBox(height: 16),
Container(
padding: const EdgeInsets.all(20),
@@ -496,12 +545,12 @@ class ProfilePage extends StatelessWidget {
children: [
Row(
children: [
Icon(Icons.info, color: AppConstants.primaryColor, size: 20),
Icon(Icons.info, color: primaryColor, size: 20),
const SizedBox(width: 8),
Text(
'关于应用',
style: TextStyle(
color: AppConstants.primaryColor,
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.bold,
),
@@ -568,7 +617,12 @@ class ProfilePage extends StatelessWidget {
);
}
Widget _buildSettingsGroup(String title, List<Widget> items, bool isDark) {
Widget _buildSettingsGroup(
String title,
List<Widget> items,
bool isDark,
Color primaryColor,
) {
return Container(
decoration: BoxDecoration(
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
@@ -590,16 +644,12 @@ class ProfilePage extends StatelessWidget {
padding: const EdgeInsets.all(16),
child: Row(
children: [
Icon(
Icons.settings_outlined,
color: AppConstants.primaryColor,
size: 20,
),
Icon(Icons.settings_outlined, color: primaryColor, size: 20),
const SizedBox(width: 8),
Text(
title,
style: TextStyle(
color: AppConstants.primaryColor,
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.bold,
),
@@ -619,9 +669,10 @@ class ProfilePage extends StatelessWidget {
IconData icon,
VoidCallback onTap,
bool isDark,
Color primaryColor,
) {
return ListTile(
leading: Icon(icon, color: AppConstants.primaryColor, size: 20),
leading: Icon(icon, color: primaryColor, size: 20),
title: Text(
title,
style: TextStyle(
@@ -641,17 +692,17 @@ class ProfilePage extends StatelessWidget {
);
}
Widget _buildScreenWakeItem(ProfileController controller, bool isDark) {
Widget _buildScreenWakeItem(
ProfileController controller,
bool isDark,
Color primaryColor,
) {
if (kIsWeb) {
return const SizedBox.shrink();
}
return ListTile(
leading: Icon(
Icons.screen_lock_rotation,
color: AppConstants.primaryColor,
size: 20,
),
leading: Icon(Icons.screen_lock_rotation, color: primaryColor, size: 20),
title: Text(
'屏幕常亮',
style: TextStyle(
@@ -680,7 +731,7 @@ class ProfilePage extends StatelessWidget {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: AppConstants.primaryColor,
color: primaryColor,
),
),
content: Column(
@@ -713,7 +764,7 @@ class ProfilePage extends StatelessWidget {
Get.back(result: true);
},
style: ElevatedButton.styleFrom(
backgroundColor: AppConstants.primaryColor,
backgroundColor: primaryColor,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
@@ -734,22 +785,27 @@ class ProfilePage extends StatelessWidget {
await controller.toggleScreenWake(value);
}
},
activeColor: AppConstants.primaryColor,
activeColor: primaryColor,
),
),
);
}
Widget _buildInteractionItem(String label, String value, bool isDark) {
Widget _buildInteractionItem(
String label,
String value,
bool isDark,
Color primaryColor,
) {
return Expanded(
child: Column(
children: [
Text(
value,
style: const TextStyle(
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: AppConstants.primaryColor,
color: primaryColor,
),
),
const SizedBox(height: 4),