From dd76437fb5ddbb4490f3ff22a67b52c43d7f4d3a Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Fri, 8 Aug 2025 15:48:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(profile):=20=E6=B7=BB=E5=8A=A0=E6=B8=85?= =?UTF-8?q?=E9=99=A4=E7=BC=93=E5=AD=98=E5=8A=9F=E8=83=BD=E5=8F=8A=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在个人资料页面添加清除缓存的功能选项,包括确认对话框和相应的多语言翻译 --- lib/core/translations/language/en_us.dart | 2 + lib/core/translations/language/zh_cn.dart | 2 + lib/modules/profile/views/profile_view.dart | 132 ++++++++++---------- 3 files changed, 70 insertions(+), 66 deletions(-) diff --git a/lib/core/translations/language/en_us.dart b/lib/core/translations/language/en_us.dart index 51d9bd764..7dca392ef 100644 --- a/lib/core/translations/language/en_us.dart +++ b/lib/core/translations/language/en_us.dart @@ -436,6 +436,8 @@ const Map enUS = { 'deleteAccount': 'Delete Account', 'deleteAccountTips': 'Are you sure you want to permanently delete your account? This action cannot be undone.', + 'clean': 'Clear Cache', // 清除缓存 + 'cleanTips': 'Are you sure you want to clear personal cache?', // 确定要清除个人缓存吗? //Profile 错误信息 'networkConnectionFailed': diff --git a/lib/core/translations/language/zh_cn.dart b/lib/core/translations/language/zh_cn.dart index 6bd1701d6..d73546416 100644 --- a/lib/core/translations/language/zh_cn.dart +++ b/lib/core/translations/language/zh_cn.dart @@ -411,6 +411,8 @@ const Map zhCN = { "logoutTips": "确定要退出当前账号吗?", 'deleteAccount': '注销账号', 'deleteAccountTips': '确定要永久删除您的账号吗?此操作不可撤销', + 'clean': '清除缓存', + 'cleanTips': '确定要清除个人缓存吗?', // Profile 错误信息 'networkConnectionFailed': '网络连接失败,请检查网络设置后重试', diff --git a/lib/modules/profile/views/profile_view.dart b/lib/modules/profile/views/profile_view.dart index 328d7c19a..4dbf73dd3 100644 --- a/lib/modules/profile/views/profile_view.dart +++ b/lib/modules/profile/views/profile_view.dart @@ -740,72 +740,72 @@ class EditProfileView extends GetView { }, isDarkMode: isDarkMode, ), - // Divider( - // height: 1, - // color: isDarkMode - // ? Colors.white.withOpacity(0.1) - // : Colors.grey[200]), - // // 清理缓存 - // _buildSimpleNavigationSetting( - // title: 'clean'.tr, // 清理缓存 - // icon: Icons.logout, - // iconBgColor: isDarkMode - // ? Colors.red[900]!.withOpacity(0.3) - // : Colors.red[50]!, - // iconColor: isDarkMode ? Colors.red[300]! : Colors.red[600]!, - // titleColor: - // isDarkMode ? Colors.red[300]! : Colors.red[600]!, - // onTap: () { - // // 退出登录确认对话框 - // Get.dialog( - // AlertDialog( - // backgroundColor: - // isDarkMode ? Colors.grey[900] : Colors.white, - // title: Text( - // 'clean'.tr, // 清理缓存 - // style: TextStyle( - // color: isDarkMode ? Colors.white : Colors.black87, - // ), - // ), - // content: Text( - // 'cleanTips'.tr, // 确定要退出当前账号吗? - // style: TextStyle( - // color: - // isDarkMode ? Colors.white70 : Colors.black54, - // ), - // ), - // actions: [ - // TextButton( - // onPressed: () => Get.back(), - // child: Text( - // 'cancel'.tr, // 取消 - // style: TextStyle( - // color: isDarkMode - // ? Colors.white70 - // : Colors.black54, - // ), - // ), - // ), - // TextButton( - // onPressed: () { - // Get.back(); - // controller.clean(); - // }, - // child: Text( - // 'confirm'.tr, // 确定 - // style: TextStyle( - // color: isDarkMode - // ? Colors.red[300] - // : Colors.red[600], - // ), - // ), - // ), - // ], - // ), - // ); - // }, - // isDarkMode: isDarkMode, - // ), + Divider( + height: 1, + color: isDarkMode + ? Colors.white.withOpacity(0.1) + : Colors.grey[200]), + // 清理缓存 + _buildSimpleNavigationSetting( + title: 'clean'.tr, // 清理缓存 + icon: Icons.cleaning_services, + iconBgColor: isDarkMode + ? Colors.red[900]!.withOpacity(0.3) + : Colors.red[50]!, + iconColor: isDarkMode ? Colors.red[300]! : Colors.red[600]!, + titleColor: + isDarkMode ? Colors.red[300]! : Colors.red[600]!, + onTap: () { + // 退出登录确认对话框 + Get.dialog( + AlertDialog( + backgroundColor: + isDarkMode ? Colors.grey[900] : Colors.white, + title: Text( + 'clean'.tr, // 清除缓存 + style: TextStyle( + color: isDarkMode ? Colors.white : Colors.black87, + ), + ), + content: Text( + 'cleanTips'.tr, // 确定要清除个人缓存吗? + style: TextStyle( + color: + isDarkMode ? Colors.white70 : Colors.black54, + ), + ), + actions: [ + TextButton( + onPressed: () => Get.back(), + child: Text( + 'cancel'.tr, // 取消 + style: TextStyle( + color: isDarkMode + ? Colors.white70 + : Colors.black54, + ), + ), + ), + TextButton( + onPressed: () { + Get.back(); + controller.clean(); + }, + child: Text( + 'confirm'.tr, // 确定 + style: TextStyle( + color: isDarkMode + ? Colors.red[300] + : Colors.red[600], + ), + ), + ), + ], + ), + ); + }, + isDarkMode: isDarkMode, + ), Divider( height: 1, color: isDarkMode