Browse Source

feat(登录): 添加隐私政策弹窗的国际化支持

refactor(反馈): 优化反馈页面样式和布局

style(翻译): 统一播放列表键名从playlist改为playList
weicu
lxm 1 year ago
parent
commit
ab7c16b1bb
  1. 13
      lib/core/translations/language/en_us.dart
  2. 12
      lib/core/translations/language/zh_cn.dart
  3. 223
      lib/modules/feedback/views/feedback_view.dart
  4. 29
      lib/modules/login/controllers/login_controller.dart
  5. 24
      lib/modules/settings/views/settings_view.dart

13
lib/core/translations/language/en_us.dart

@ -97,6 +97,17 @@ const Map<String, String> enUS = {
"login": "Login", "login": "Login",
"usePasswordLogin": "Use password login", "usePasswordLogin": "Use password login",
// 隐私政策弹窗
"loginDeclaration": "DeapSound Declaration", // DeapSound 声明
"welcomeToThisApp":
"Welcome to DeapSound, please read carefully ", // 欢迎使用DeapSound,请充分阅读
// "privacyPolicy": "Privacy Policy", // 《隐私政策》 - 已存在,使用现有键
// "userAgreement": "User Agreement", // 《用户协议》 - 已存在,使用现有键
"privacyPolicyText":
". By clicking \"Agree and Enter\", you indicate that you have fully read and agree to the above agreements. Clicking \"Disagree\" will exit the application.", // ,点击"同意并进入"表示您已充分阅读并同意上述协议。点击"不同意"将退出应用。
"disagree": "Disagree", // 不同意
"agreeAndEnter": "Agree and Enter", // 同意并进入
// 首页 // 首页
"deviceStatus": "Device Status", "deviceStatus": "Device Status",
"reconnect": "Reconnect", "reconnect": "Reconnect",
@ -342,7 +353,7 @@ const Map<String, String> enUS = {
//music_card //music_card
'recommendedMusic': 'Here are some recommended music:', 'recommendedMusic': 'Here are some recommended music:',
'playlist': 'Playlist', 'playList': 'Playlist',
'moreMusic': 'More music', 'moreMusic': 'More music',
//导航卡片 navigation_card //导航卡片 navigation_card

12
lib/core/translations/language/zh_cn.dart

@ -95,6 +95,16 @@ const Map<String, String> zhCN = {
"login": "登录", "login": "登录",
"usePasswordLogin": "使用密码登录", "usePasswordLogin": "使用密码登录",
// 隐私政策弹窗
"loginDeclaration": "DeapSound 声明", // DeapSound 声明
"welcomeToThisApp": "欢迎使用DeapSound,请充分阅读", // 欢迎使用DeapSound,请充分阅读
// "privacyPolicy": "《隐私政策》", // 《隐私政策》 - 已存在,使用现有键
// "userAgreement": "《用户协议》", // 《用户协议》 - 已存在,使用现有键
"privacyPolicyText":
",点击'同意并进入'表示您已充分阅读并同意上述协议。点击'不同意'将退出应用。", // ,点击"同意并进入"表示您已充分阅读并同意上述协议。点击"不同意"将退出应用。
"disagree": "不同意", // 不同意
"agreeAndEnter": "同意并进入", // 同意并进入
// 首页 // 首页
"deviceStatus": "设备状态", "deviceStatus": "设备状态",
"reconnect": "重新连接", "reconnect": "重新连接",
@ -328,7 +338,7 @@ const Map<String, String> zhCN = {
//音乐卡片 music_card //音乐卡片 music_card
'recommendedMusic': '以下是一些推荐的音乐:', 'recommendedMusic': '以下是一些推荐的音乐:',
'playlist': '播放列表', 'playList': '播放列表',
'moreMusic': '更多音乐', 'moreMusic': '更多音乐',
//导航卡片 navigation_card //导航卡片 navigation_card

223
lib/modules/feedback/views/feedback_view.dart

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'dart:ui';
import '../controllers/feedback_controller.dart'; import '../controllers/feedback_controller.dart';
class FeedbackView extends GetView<FeedbackController> { class FeedbackView extends GetView<FeedbackController> {
@ -51,148 +50,120 @@ class FeedbackView extends GetView<FeedbackController> {
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
// 反馈内容输入框 // 反馈内容输入框 - 统一容器样式
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDarkMode // 保持适合各自模式的背景色
? Colors.white.withOpacity(0.05) color: isDarkMode ? Colors.grey[800] : Colors.white,
: Colors.white, // 统一圆角
borderRadius: BorderRadius.circular(16.r), borderRadius: BorderRadius.circular(16.r),
// 统一阴影效果 - 关键改进点
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: isDarkMode color: isDarkMode
? Colors.black.withOpacity(0.2) ? Colors.black.withOpacity(0.3)
: Colors.black.withOpacity(0.05), : Colors.black.withOpacity(0.08),
blurRadius: 10, blurRadius: 12,
offset: const Offset(0, 2), offset: const Offset(0, 4),
spreadRadius: 0,
), ),
], ],
// 统一边框样式 - 关键改进点
border: Border.all(
color: isDarkMode ? Colors.grey[700]! : Colors.grey[200]!,
width: 1.5,
),
), ),
child: ClipRRect( child: Padding(
borderRadius: BorderRadius.circular(16.r), padding:
child: BackdropFilter( EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
filter: isDarkMode child: TextFormField(
? ImageFilter.blur(sigmaX: 5, sigmaY: 5) controller: controller.feedbackController,
: ImageFilter.blur(sigmaX: 0, sigmaY: 0), maxLines: 8,
child: Padding( maxLength: 500,
padding: style: TextStyle(
EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), color: isDarkMode ? Colors.white : Colors.black87,
child: TextFormField( fontSize: 14.sp,
controller: controller.feedbackController, height: 1.4,
maxLines: 8, ),
maxLength: 500, decoration: InputDecoration(
style: TextStyle( hintText: 'feedbackHint'.tr, // 请输入您的反馈内容...
color: isDarkMode ? Colors.white : Colors.black87, hintStyle: TextStyle(
), color: isDarkMode ? Colors.grey[400] : Colors.grey[500],
decoration: InputDecoration( fontSize: 14.sp,
hintText: 'feedbackHint'.tr, // 请输入您的反馈内容... ),
hintStyle: TextStyle( border: InputBorder.none,
color: isDarkMode ? Colors.white38 : Colors.black38, focusedBorder: InputBorder.none,
), counterStyle: TextStyle(
border: InputBorder.none, color: isDarkMode ? Colors.grey[400] : Colors.grey[600],
counterStyle: TextStyle( fontSize: 12.sp,
color: isDarkMode ? Colors.white54 : Colors.black54,
),
),
validator: (value) {
if (value == null || value.trim().isEmpty) {
return 'feedbackRequired'.tr; // 请输入反馈内容
}
return null;
},
), ),
contentPadding: EdgeInsets.zero,
fillColor: Colors.transparent,
filled: true,
), ),
validator: (value) {
if (value == null || value.trim().isEmpty) {
return 'feedbackRequired'.tr; // 请输入反馈内容
}
return null;
},
), ),
), ),
), ),
SizedBox(height: 24.h), SizedBox(height: 40.h),
// 联系方式标题
// Text(
// 'contactInfo'.tr, // 联系方式
// style: TextStyle(
// fontSize: 14.sp,
// color: isDarkMode ? Colors.white70 : Colors.black54,
// ),
// ),
// SizedBox(height: 16.h),
// // 联系方式输入框 // 提交按钮 - 统一容器样式
// Container( Obx(() => Container(
// decoration: BoxDecoration( // 统一按钮容器装饰
// color: isDarkMode decoration: BoxDecoration(
// ? Colors.white.withOpacity(0.05) borderRadius: BorderRadius.circular(16.r),
// : Colors.white, // 统一阴影效果
// borderRadius: BorderRadius.circular(16.r), boxShadow: controller.isSubmitting.value
// boxShadow: [ ? []
// BoxShadow( : [
// color: isDarkMode BoxShadow(
// ? Colors.black.withOpacity(0.2) color: Colors.blue.withOpacity(0.3),
// : Colors.black.withOpacity(0.05), blurRadius: 8,
// blurRadius: 10, offset: const Offset(0, 4),
// offset: const Offset(0, 2), spreadRadius: 0,
// ), ),
// ], ],
// ),
// child: ClipRRect(
// borderRadius: BorderRadius.circular(16.r),
// child: BackdropFilter(
// filter: isDarkMode
// ? ImageFilter.blur(sigmaX: 5, sigmaY: 5)
// : ImageFilter.blur(sigmaX: 0, sigmaY: 0),
// child: Padding(
// padding:
// EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
// child: TextFormField(
// controller: controller.contactController,
// style: TextStyle(
// color: isDarkMode ? Colors.white : Colors.black87,
// ),
// decoration: InputDecoration(
// hintText: 'contactHint'.tr, // 邮箱/手机号,方便我们联系您
// hintStyle: TextStyle(
// color: isDarkMode ? Colors.white38 : Colors.black38,
// ),
// border: InputBorder.none,
// ),
// ),
// ),
// ),
// ),
// ),
// SizedBox(height: 40.h),
// 提交按钮
Obx(() => ElevatedButton(
onPressed: controller.isSubmitting.value
? null
: controller.submitFeedback,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue[600],
padding: EdgeInsets.symmetric(vertical: 12.h),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16.r),
),
elevation: 0,
), ),
child: controller.isSubmitting.value child: ElevatedButton(
? SizedBox( onPressed: controller.isSubmitting.value
height: 20.h, ? null
width: 20.h, : controller.submitFeedback,
child: CircularProgressIndicator( style: ElevatedButton.styleFrom(
strokeWidth: 2.w, backgroundColor: controller.isSubmitting.value
valueColor: const AlwaysStoppedAnimation<Color>( ? Colors.grey[400]
Colors.white), : Colors.blue[600],
), padding: EdgeInsets.symmetric(vertical: 14.h),
) shape: RoundedRectangleBorder(
: Text( borderRadius: BorderRadius.circular(16.r),
'submit'.tr, // 提交 ),
style: TextStyle( elevation: 0,
fontSize: 16.sp, shadowColor: Colors.transparent,
fontWeight: FontWeight.w500, ),
color: Colors.white, child: controller.isSubmitting.value
? SizedBox(
height: 20.h,
width: 20.h,
child: CircularProgressIndicator(
strokeWidth: 2.w,
valueColor: const AlwaysStoppedAnimation<Color>(
Colors.white),
),
)
: Text(
'submit'.tr, // 提交
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w600,
color: Colors.white,
),
), ),
), ),
)), )),
], ],
), ),

29
lib/modules/login/controllers/login_controller.dart

@ -218,7 +218,7 @@ class LoginController extends GetxController {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
'DeapSound 声明', 'loginDeclaration'.tr, //APP 声明
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -233,7 +233,7 @@ class LoginController extends GetxController {
TextSpan( TextSpan(
children: [ children: [
TextSpan( TextSpan(
text: '欢迎使用DeapSound,请充分阅读', text: 'welcomeToThisApp'.tr, //欢迎使用本APP,请充分阅读
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: isDarkMode color: isDarkMode
@ -252,12 +252,12 @@ class LoginController extends GetxController {
} }
Get.to(() => WebViewPage( Get.to(() => WebViewPage(
url: url, url: url,
title: 'privacyPolicy'.tr, title: 'privacyPolicy'.tr, //隐私政策
)); ));
}, },
child: const Text( child: Text(
'《隐私政策》', 'privacyPolicy'.tr, //隐私政策
style: TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF3B82F6), color: Color(0xFF3B82F6),
), ),
@ -265,7 +265,7 @@ class LoginController extends GetxController {
), ),
), ),
TextSpan( TextSpan(
text: '和', text: 'and'.tr, //和
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: isDarkMode ? Colors.white70 : Colors.black87, color: isDarkMode ? Colors.white70 : Colors.black87,
@ -282,12 +282,12 @@ class LoginController extends GetxController {
} }
Get.to(() => WebViewPage( Get.to(() => WebViewPage(
url: url, url: url,
title: 'userAgreement'.tr, title: 'userAgreement'.tr, //用户协议
)); ));
}, },
child: const Text( child: Text(
'《用户协议》', 'userAgreement'.tr, //用户协议
style: TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF3B82F6), color: Color(0xFF3B82F6),
), ),
@ -295,7 +295,8 @@ class LoginController extends GetxController {
), ),
), ),
TextSpan( TextSpan(
text: ',点击“同意并进入”表示您已充分阅读并同意上述协议。点击“不同意”将退出应用。', text: 'privacyPolicyText'
.tr, //',点击“同意并进入”表示您已充分阅读并同意上述协议。点击“不同意”将退出应用。',
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: isDarkMode ? Colors.white70 : Colors.black87, color: isDarkMode ? Colors.white70 : Colors.black87,
@ -321,7 +322,7 @@ class LoginController extends GetxController {
: Colors.black54, // 暗黑模式使用浅灰色 : Colors.black54, // 暗黑模式使用浅灰色
), ),
child: Text( child: Text(
'不同意', 'disagree'.tr, //不同意
style: TextStyle( style: TextStyle(
color: isDarkMode ? Colors.grey[400] : Colors.black54, color: isDarkMode ? Colors.grey[400] : Colors.black54,
), ),
@ -346,7 +347,7 @@ class LoginController extends GetxController {
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 10), // 统一的内边距 horizontal: 16, vertical: 10), // 统一的内边距
), ),
child: const Text('同意并进入'), child: Text('agreeAndEnter'.tr),
), ),
], ],
), ),

24
lib/modules/settings/views/settings_view.dart

@ -374,18 +374,18 @@ class SettingsView extends GetView<SettingsController> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( // Padding(
padding: EdgeInsets.only(left: 4.w, bottom: 8.h), // padding: EdgeInsets.only(left: 4.w, bottom: 8.h),
child: Text( // child: Text(
'systemSettings'.tr, // 系统设置 // 'systemSettings'.tr, // 系统设置
style: TextStyle( // style: TextStyle(
fontSize: 12.sp, // fontSize: 12.sp,
fontWeight: FontWeight.w500, // fontWeight: FontWeight.w500,
color: isDarkMode ? Colors.blue[400] : Colors.blue[600], // color: isDarkMode ? Colors.blue[400] : Colors.blue[600],
letterSpacing: 1, // letterSpacing: 1,
), // ),
), // ),
), // ),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white,

Loading…
Cancel
Save