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",
"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",
"reconnect": "Reconnect",
@ -342,7 +353,7 @@ const Map<String, String> enUS = {
//music_card
'recommendedMusic': 'Here are some recommended music:',
'playlist': 'Playlist',
'playList': 'Playlist',
'moreMusic': 'More music',
//导航卡片 navigation_card

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

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

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

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'dart:ui';
import '../controllers/feedback_controller.dart';
class FeedbackView extends GetView<FeedbackController> {
@ -51,148 +50,120 @@ class FeedbackView extends GetView<FeedbackController> {
),
SizedBox(height: 16.h),
// 反馈内容输入框
// 反馈内容输入框 - 统一容器样式
Container(
decoration: BoxDecoration(
color: isDarkMode
? Colors.white.withOpacity(0.05)
: Colors.white,
// 保持适合各自模式的背景色
color: isDarkMode ? Colors.grey[800] : Colors.white,
// 统一圆角
borderRadius: BorderRadius.circular(16.r),
// 统一阴影效果 - 关键改进点
boxShadow: [
BoxShadow(
color: isDarkMode
? Colors.black.withOpacity(0.2)
: Colors.black.withOpacity(0.05),
blurRadius: 10,
offset: const Offset(0, 2),
? Colors.black.withOpacity(0.3)
: Colors.black.withOpacity(0.08),
blurRadius: 12,
offset: const Offset(0, 4),
spreadRadius: 0,
),
],
// 统一边框样式 - 关键改进点
border: Border.all(
color: isDarkMode ? Colors.grey[700]! : Colors.grey[200]!,
width: 1.5,
),
),
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.feedbackController,
maxLines: 8,
maxLength: 500,
style: TextStyle(
color: isDarkMode ? Colors.white : Colors.black87,
),
decoration: InputDecoration(
hintText: 'feedbackHint'.tr, // 请输入您的反馈内容...
hintStyle: TextStyle(
color: isDarkMode ? Colors.white38 : Colors.black38,
),
border: InputBorder.none,
counterStyle: TextStyle(
color: isDarkMode ? Colors.white54 : Colors.black54,
),
),
validator: (value) {
if (value == null || value.trim().isEmpty) {
return 'feedbackRequired'.tr; // 请输入反馈内容
}
return null;
},
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
child: TextFormField(
controller: controller.feedbackController,
maxLines: 8,
maxLength: 500,
style: TextStyle(
color: isDarkMode ? Colors.white : Colors.black87,
fontSize: 14.sp,
height: 1.4,
),
decoration: InputDecoration(
hintText: 'feedbackHint'.tr, // 请输入您的反馈内容...
hintStyle: TextStyle(
color: isDarkMode ? Colors.grey[400] : Colors.grey[500],
fontSize: 14.sp,
),
border: InputBorder.none,
focusedBorder: InputBorder.none,
counterStyle: TextStyle(
color: isDarkMode ? Colors.grey[400] : Colors.grey[600],
fontSize: 12.sp,
),
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),
// 联系方式标题
// Text(
// 'contactInfo'.tr, // 联系方式
// style: TextStyle(
// fontSize: 14.sp,
// color: isDarkMode ? Colors.white70 : Colors.black54,
// ),
// ),
// SizedBox(height: 16.h),
SizedBox(height: 40.h),
// // 联系方式输入框
// Container(
// decoration: BoxDecoration(
// color: isDarkMode
// ? Colors.white.withOpacity(0.05)
// : Colors.white,
// borderRadius: BorderRadius.circular(16.r),
// boxShadow: [
// BoxShadow(
// color: isDarkMode
// ? Colors.black.withOpacity(0.2)
// : Colors.black.withOpacity(0.05),
// blurRadius: 10,
// offset: const Offset(0, 2),
// ),
// ],
// ),
// 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,
// 提交按钮 - 统一容器样式
Obx(() => Container(
// 统一按钮容器装饰
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.r),
// 统一阴影效果
boxShadow: controller.isSubmitting.value
? []
: [
BoxShadow(
color: Colors.blue.withOpacity(0.3),
blurRadius: 8,
offset: const Offset(0, 4),
spreadRadius: 0,
),
],
),
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.w500,
color: Colors.white,
child: ElevatedButton(
onPressed: controller.isSubmitting.value
? null
: controller.submitFeedback,
style: ElevatedButton.styleFrom(
backgroundColor: controller.isSubmitting.value
? Colors.grey[400]
: Colors.blue[600],
padding: EdgeInsets.symmetric(vertical: 14.h),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16.r),
),
elevation: 0,
shadowColor: Colors.transparent,
),
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,
children: [
Text(
'DeapSound 声明',
'loginDeclaration'.tr, //APP 声明
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
@ -233,7 +233,7 @@ class LoginController extends GetxController {
TextSpan(
children: [
TextSpan(
text: '欢迎使用DeapSound,请充分阅读',
text: 'welcomeToThisApp'.tr, //欢迎使用本APP,请充分阅读
style: TextStyle(
fontSize: 14,
color: isDarkMode
@ -252,12 +252,12 @@ class LoginController extends GetxController {
}
Get.to(() => WebViewPage(
url: url,
title: 'privacyPolicy'.tr,
title: 'privacyPolicy'.tr, //隐私政策
));
},
child: const Text(
'《隐私政策》',
style: TextStyle(
child: Text(
'privacyPolicy'.tr, //隐私政策
style: const TextStyle(
fontSize: 14,
color: Color(0xFF3B82F6),
),
@ -265,7 +265,7 @@ class LoginController extends GetxController {
),
),
TextSpan(
text: '和',
text: 'and'.tr, //和
style: TextStyle(
fontSize: 14,
color: isDarkMode ? Colors.white70 : Colors.black87,
@ -282,12 +282,12 @@ class LoginController extends GetxController {
}
Get.to(() => WebViewPage(
url: url,
title: 'userAgreement'.tr,
title: 'userAgreement'.tr, //用户协议
));
},
child: const Text(
'《用户协议》',
style: TextStyle(
child: Text(
'userAgreement'.tr, //用户协议
style: const TextStyle(
fontSize: 14,
color: Color(0xFF3B82F6),
),
@ -295,7 +295,8 @@ class LoginController extends GetxController {
),
),
TextSpan(
text: ',点击“同意并进入”表示您已充分阅读并同意上述协议。点击“不同意”将退出应用。',
text: 'privacyPolicyText'
.tr, //',点击“同意并进入”表示您已充分阅读并同意上述协议。点击“不同意”将退出应用。',
style: TextStyle(
fontSize: 14,
color: isDarkMode ? Colors.white70 : Colors.black87,
@ -321,7 +322,7 @@ class LoginController extends GetxController {
: Colors.black54, // 暗黑模式使用浅灰色
),
child: Text(
'不同意',
'disagree'.tr, //不同意
style: TextStyle(
color: isDarkMode ? Colors.grey[400] : Colors.black54,
),
@ -346,7 +347,7 @@ class LoginController extends GetxController {
padding: const EdgeInsets.symmetric(
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(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(left: 4.w, bottom: 8.h),
child: Text(
'systemSettings'.tr, // 系统设置
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w500,
color: isDarkMode ? Colors.blue[400] : Colors.blue[600],
letterSpacing: 1,
),
),
),
// Padding(
// padding: EdgeInsets.only(left: 4.w, bottom: 8.h),
// child: Text(
// 'systemSettings'.tr, // 系统设置
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: FontWeight.w500,
// color: isDarkMode ? Colors.blue[400] : Colors.blue[600],
// letterSpacing: 1,
// ),
// ),
// ),
Container(
decoration: BoxDecoration(
color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white,

Loading…
Cancel
Save