|
|
|
@ -1,10 +1,7 @@ |
|
|
|
import 'package:app_settings/app_settings.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:get/get.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'dart:ui'; |
|
|
|
import 'dart:io'; |
|
|
|
import '../../../core/theme/app_colors.dart'; |
|
|
|
import '../controllers/settings_controller.dart'; |
|
|
|
import '../../../core/widgets/common_bottom_nav.dart'; |
|
|
|
import '../../../routes/app_routes.dart'; |
|
|
|
@ -67,8 +64,8 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
gradient: LinearGradient( |
|
|
|
colors: isDarkMode |
|
|
|
? [ |
|
|
|
const Color(0xFF1A1A1A).withOpacity(0.7), |
|
|
|
const Color(0xFF2A2A2A).withOpacity(0.7) |
|
|
|
const Color(0xFF1A1A1A).withValues(alpha: 0.7), |
|
|
|
const Color(0xFF2A2A2A).withValues(alpha: 0.7) |
|
|
|
] |
|
|
|
: [const Color(0xFFE3F2FD), const Color(0xFFF3E5F5)], |
|
|
|
begin: Alignment.topLeft, |
|
|
|
@ -78,8 +75,8 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.black.withOpacity(0.2) |
|
|
|
: Colors.black.withOpacity(0.05), |
|
|
|
? Colors.black.withValues(alpha: 0.2) |
|
|
|
: Colors.black.withValues(alpha: 0.05), |
|
|
|
blurRadius: 10, |
|
|
|
offset: const Offset(0, 2), |
|
|
|
), |
|
|
|
@ -106,7 +103,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
isDarkMode: isDarkMode, |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: Colors.black.withOpacity(0.1), |
|
|
|
color: Colors.black.withValues(alpha: 0.1), |
|
|
|
blurRadius: 8, |
|
|
|
offset: const Offset(0, 2), |
|
|
|
), |
|
|
|
@ -190,12 +187,12 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
height: 32.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.white.withOpacity(0.7), |
|
|
|
? Colors.white.withValues(alpha: 0.1) |
|
|
|
: Colors.white.withValues(alpha: 0.7), |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: Colors.black.withOpacity(0.05), |
|
|
|
color: Colors.black.withValues(alpha: 0.05), |
|
|
|
blurRadius: 4, |
|
|
|
offset: const Offset(0, 1), |
|
|
|
), |
|
|
|
@ -225,8 +222,8 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
gradient: LinearGradient( |
|
|
|
colors: isDarkMode |
|
|
|
? [ |
|
|
|
const Color(0xFF0D47A1).withOpacity(0.5), |
|
|
|
const Color(0xFF1976D2).withOpacity(0.5) |
|
|
|
const Color(0xFF0D47A1).withValues(alpha: 0.5), |
|
|
|
const Color(0xFF1976D2).withValues(alpha: 0.5) |
|
|
|
] |
|
|
|
: [const Color(0xFFE3F2FD), const Color(0xFFBBDEFB)], |
|
|
|
begin: Alignment.topLeft, |
|
|
|
@ -236,8 +233,8 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.black.withOpacity(0.2) |
|
|
|
: Colors.black.withOpacity(0.05), |
|
|
|
? Colors.black.withValues(alpha: 0.2) |
|
|
|
: Colors.black.withValues(alpha: 0.05), |
|
|
|
blurRadius: 10, |
|
|
|
offset: const Offset(0, 2), |
|
|
|
), |
|
|
|
@ -262,7 +259,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
icon: Icons.workspace_premium, |
|
|
|
label: 'aiRecharge'.tr, //AI充值 |
|
|
|
iconBg: isDarkMode |
|
|
|
? Colors.amber[900]!.withOpacity(0.3) |
|
|
|
? Colors.amber[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.amber[100]!, |
|
|
|
iconColor: isDarkMode ? Colors.amber[300]! : Colors.amber[600]!, |
|
|
|
textColor: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
@ -272,7 +269,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
icon: Icons.translate, |
|
|
|
label: 'translationRecharge'.tr, //翻译充值 |
|
|
|
iconBg: isDarkMode |
|
|
|
? Colors.indigo[900]!.withOpacity(0.3) |
|
|
|
? Colors.indigo[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.indigo[100]!, |
|
|
|
iconColor: |
|
|
|
isDarkMode ? Colors.indigo[300]! : Colors.indigo[600]!, |
|
|
|
@ -283,7 +280,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
icon: Icons.people, |
|
|
|
label: 'meetingAssistantRecharge'.tr, //会议充值 |
|
|
|
iconBg: isDarkMode |
|
|
|
? Colors.pink[900]!.withOpacity(0.3) |
|
|
|
? Colors.pink[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.pink[100]!, |
|
|
|
iconColor: isDarkMode ? Colors.pink[300]! : Colors.pink[600]!, |
|
|
|
textColor: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
@ -293,7 +290,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
icon: Icons.analytics_outlined, |
|
|
|
label: 'usageStats'.tr, //用量统计 |
|
|
|
iconBg: isDarkMode |
|
|
|
? Colors.teal[900]!.withOpacity(0.3) |
|
|
|
? Colors.teal[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.teal[100]!, |
|
|
|
iconColor: isDarkMode ? Colors.teal[300]! : Colors.teal[600]!, |
|
|
|
textColor: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
@ -357,104 +354,6 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// AI设置 |
|
|
|
Widget _buildAISettingsSection(bool isDarkMode) { |
|
|
|
return Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.only(left: 4.w, bottom: 8.h), |
|
|
|
child: Text( |
|
|
|
'AIsettings'.tr, // AI设置 |
|
|
|
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, |
|
|
|
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: Column( |
|
|
|
children: [ |
|
|
|
// 语音服务选择 |
|
|
|
_buildSpeechServiceSetting(isDarkMode), |
|
|
|
Divider( |
|
|
|
height: 1, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.grey[200]), |
|
|
|
Obx( |
|
|
|
() => _buildNavigationSetting( |
|
|
|
title: 'timbreService'.tr, // 音色服务 |
|
|
|
subtitle: 'timbreServiceInfo'.tr, // 选择音色服务 |
|
|
|
icon: Icons.photo_camera_front_outlined, |
|
|
|
iconBgColor: isDarkMode |
|
|
|
? Colors.cyan[900]!.withOpacity(0.3) |
|
|
|
: Colors.cyan[100]!, |
|
|
|
iconColor: |
|
|
|
isDarkMode ? Colors.cyan[300]! : Colors.cyan[600]!, |
|
|
|
value: controller.timbreName.value.tr, // 当前音色 |
|
|
|
valueStyle: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[500], |
|
|
|
), |
|
|
|
onTap: () { |
|
|
|
Get.toNamed(Routes.timbre); |
|
|
|
}, |
|
|
|
isDarkMode: isDarkMode, |
|
|
|
), |
|
|
|
), |
|
|
|
Divider( |
|
|
|
height: 1, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.grey[200]), |
|
|
|
// 实时对话入口 |
|
|
|
_buildSimpleNavigationSetting( |
|
|
|
title: 'realtimeVoiceChat'.tr, // 实时语音对话 |
|
|
|
subtitle: 'realtimeVoiceChatInfo'.tr, // 实时语音对话信息 |
|
|
|
icon: Icons.chat_bubble_outline, |
|
|
|
iconBgColor: isDarkMode |
|
|
|
? Colors.purple[900]!.withOpacity(0.3) |
|
|
|
: Colors.purple[100]!, |
|
|
|
iconColor: |
|
|
|
isDarkMode ? Colors.purple[300]! : Colors.purple[600]!, |
|
|
|
titleColor: isDarkMode ? Colors.white : null, |
|
|
|
subtitleColor: isDarkMode ? Colors.white70 : null, |
|
|
|
onTap: () { |
|
|
|
Get.toNamed(Routes.realtime); |
|
|
|
}, |
|
|
|
isDarkMode: isDarkMode, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 系统设置部分 |
|
|
|
Widget _buildSystemSettingsSection(bool isDarkMode) { |
|
|
|
return Column( |
|
|
|
@ -474,13 +373,15 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
// ), |
|
|
|
Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withValues(alpha: 0.05) |
|
|
|
: Colors.white, |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.black.withOpacity(0.2) |
|
|
|
: Colors.black.withOpacity(0.05), |
|
|
|
? Colors.black.withValues(alpha: 0.2) |
|
|
|
: Colors.black.withValues(alpha: 0.05), |
|
|
|
blurRadius: 10, |
|
|
|
offset: const Offset(0, 2), |
|
|
|
), |
|
|
|
@ -501,7 +402,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
subtitle: controller.language.value.name.tr, // 当前语言 |
|
|
|
icon: Icons.language, |
|
|
|
iconBgColor: isDarkMode |
|
|
|
? Colors.indigo[900]!.withOpacity(0.3) |
|
|
|
? Colors.indigo[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.indigo[100]!, |
|
|
|
iconColor: isDarkMode |
|
|
|
? Colors.indigo[300]! |
|
|
|
@ -517,7 +418,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
Divider( |
|
|
|
height: 1, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
? Colors.white.withValues(alpha: 0.1) |
|
|
|
: Colors.grey[200]), |
|
|
|
|
|
|
|
// 主题设置 |
|
|
|
@ -526,7 +427,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
subtitle: 'darkModeInfo'.tr, // 切换应用的明暗主题 |
|
|
|
icon: isDarkMode ? Icons.dark_mode : Icons.light_mode, |
|
|
|
iconBgColor: isDarkMode |
|
|
|
? Colors.indigo[900]!.withOpacity(0.3) |
|
|
|
? Colors.indigo[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.amber[100]!, |
|
|
|
iconColor: |
|
|
|
isDarkMode ? Colors.indigo[300]! : Colors.amber[600]!, |
|
|
|
@ -539,7 +440,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
Divider( |
|
|
|
height: 1, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
? Colors.white.withValues(alpha: 0.1) |
|
|
|
: Colors.grey[200]), |
|
|
|
|
|
|
|
// 用户反馈 |
|
|
|
@ -548,7 +449,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
subtitle: 'feedbackInfo'.tr, // 提供反馈或建议 |
|
|
|
icon: Icons.feedback_outlined, |
|
|
|
iconBgColor: isDarkMode |
|
|
|
? Colors.orange[900]!.withOpacity(0.3) |
|
|
|
? Colors.orange[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.orange[100]!, |
|
|
|
iconColor: |
|
|
|
isDarkMode ? Colors.orange[300]! : Colors.orange[600]!, |
|
|
|
@ -589,7 +490,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
Divider( |
|
|
|
height: 1, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
? Colors.white.withValues(alpha: 0.1) |
|
|
|
: Colors.grey[200]), |
|
|
|
|
|
|
|
// 配对设备管理 |
|
|
|
@ -598,7 +499,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
subtitle: 'manageConnectedDevices'.tr, // 管理已绑定的蓝牙设备 |
|
|
|
icon: Icons.device_hub, |
|
|
|
iconBgColor: isDarkMode |
|
|
|
? Colors.red[900]!.withOpacity(0.3) |
|
|
|
? Colors.red[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.red[100]!, |
|
|
|
iconColor: isDarkMode ? Colors.red[300]! : Colors.red[600]!, |
|
|
|
titleColor: isDarkMode ? Colors.white : null, |
|
|
|
@ -609,7 +510,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
Divider( |
|
|
|
height: 1, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
? Colors.white.withValues(alpha: 0.1) |
|
|
|
: Colors.grey[200]), |
|
|
|
|
|
|
|
// // 杰理测试 |
|
|
|
@ -665,7 +566,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
subtitle: '测试opus解码', |
|
|
|
icon: Icons.bluetooth_searching, |
|
|
|
iconBgColor: isDarkMode |
|
|
|
? Colors.green[900]!.withOpacity(0.3) |
|
|
|
? Colors.green[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.green[100]!, |
|
|
|
iconColor: isDarkMode |
|
|
|
? Colors.green[300]! |
|
|
|
@ -749,7 +650,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
subtitle: 'bleHeadsetFirmwareUpgrade'.tr, // BLE耳机固件版本升级 |
|
|
|
icon: Icons.system_update_alt, |
|
|
|
iconBgColor: isDarkMode |
|
|
|
? Colors.orange[900]!.withOpacity(0.3) |
|
|
|
? Colors.orange[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.orange[100]!, |
|
|
|
iconColor: |
|
|
|
isDarkMode ? Colors.orange[300]! : Colors.orange[600]!, |
|
|
|
@ -761,7 +662,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
Divider( |
|
|
|
height: 1, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
? Colors.white.withValues(alpha: 0.1) |
|
|
|
: Colors.grey[200]), |
|
|
|
|
|
|
|
// 权限管理设置项 |
|
|
|
@ -770,7 +671,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
subtitle: 'permissionManagementInfo'.tr, // 管理应用权限设置 |
|
|
|
icon: Icons.security, |
|
|
|
iconBgColor: isDarkMode |
|
|
|
? Colors.orange[900]!.withOpacity(0.3) |
|
|
|
? Colors.orange[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.orange[100]!, |
|
|
|
iconColor: |
|
|
|
isDarkMode ? Colors.orange[300]! : Colors.orange[600]!, |
|
|
|
@ -811,13 +712,15 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
Container( |
|
|
|
padding: EdgeInsets.all(16.w), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withValues(alpha: 0.05) |
|
|
|
: Colors.white, |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.black.withOpacity(0.2) |
|
|
|
: Colors.black.withOpacity(0.05), |
|
|
|
? Colors.black.withValues(alpha: 0.2) |
|
|
|
: Colors.black.withValues(alpha: 0.05), |
|
|
|
blurRadius: 10, |
|
|
|
offset: const Offset(0, 2), |
|
|
|
), |
|
|
|
@ -842,9 +745,9 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
gradient: LinearGradient( |
|
|
|
colors: [ |
|
|
|
const Color(0xFF2196F3) |
|
|
|
.withOpacity(isDarkMode ? 0.7 : 1.0), |
|
|
|
.withValues(alpha: isDarkMode ? 0.7 : 1.0), |
|
|
|
const Color(0xFF9C27B0) |
|
|
|
.withOpacity(isDarkMode ? 0.7 : 1.0) |
|
|
|
.withValues(alpha: isDarkMode ? 0.7 : 1.0) |
|
|
|
], |
|
|
|
begin: Alignment.topLeft, |
|
|
|
end: Alignment.bottomRight, |
|
|
|
@ -908,7 +811,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.blue[900]!.withOpacity(0.3) |
|
|
|
? Colors.blue[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.blue[100], |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
@ -1089,114 +992,6 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 带导航的设置项 |
|
|
|
Widget _buildNavigationSetting({ |
|
|
|
required String title, |
|
|
|
String? subtitle, |
|
|
|
required IconData icon, |
|
|
|
required Color iconBgColor, |
|
|
|
required Color iconColor, |
|
|
|
required String value, |
|
|
|
TextStyle? valueStyle, |
|
|
|
required VoidCallback onTap, |
|
|
|
required bool isDarkMode, |
|
|
|
}) { |
|
|
|
return InkWell( |
|
|
|
onTap: onTap, |
|
|
|
child: Padding( |
|
|
|
padding: EdgeInsets.all(16.w), |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: [ |
|
|
|
Expanded( |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
width: 32.w, |
|
|
|
height: 32.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: iconBgColor, |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
child: Icon( |
|
|
|
icon, |
|
|
|
size: 16.w, |
|
|
|
color: iconColor, |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(width: 12.w), |
|
|
|
Flexible( |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
title, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
height: 1.2, // 设置行高,提升多行文本可读性 |
|
|
|
), |
|
|
|
softWrap: true, // 启用软换行 |
|
|
|
overflow: TextOverflow.visible, // 确保文本完全显示 |
|
|
|
), |
|
|
|
if (subtitle != null) SizedBox(height: 2.h), |
|
|
|
if (subtitle != null) |
|
|
|
Text( |
|
|
|
subtitle, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
color: |
|
|
|
isDarkMode ? Colors.white70 : Colors.black54, |
|
|
|
height: 1.3, // 设置行高,提升多行文本可读性 |
|
|
|
), |
|
|
|
softWrap: true, // 启用软换行 |
|
|
|
overflow: TextOverflow.visible, // 确保文本完全显示 |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
Row( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
children: [ |
|
|
|
Flexible( |
|
|
|
child: Text( |
|
|
|
value, |
|
|
|
style: valueStyle ?? |
|
|
|
TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(width: 8.w), |
|
|
|
Container( |
|
|
|
width: 32.w, |
|
|
|
height: 32.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.05) |
|
|
|
: Colors.grey[100], |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
child: Icon( |
|
|
|
Icons.chevron_right, |
|
|
|
size: 16.w, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[500], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 简单导航设置项 |
|
|
|
Widget _buildSimpleNavigationSetting({ |
|
|
|
required String title, |
|
|
|
@ -1275,7 +1070,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
height: 32.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.05) |
|
|
|
? Colors.white.withValues(alpha: 0.05) |
|
|
|
: Colors.grey[100], |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
@ -1291,244 +1086,6 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 语音服务设置项 |
|
|
|
Widget _buildSpeechServiceSetting(bool isDarkMode) { |
|
|
|
return InkWell( |
|
|
|
onTap: () { |
|
|
|
_showSpeechServiceSelectionDialog(isDarkMode); |
|
|
|
}, |
|
|
|
child: Padding( |
|
|
|
padding: EdgeInsets.all(16.w), |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: [ |
|
|
|
Expanded( |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
//语音服务图标 |
|
|
|
width: 32.w, |
|
|
|
height: 32.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.teal[900]!.withOpacity(0.3) |
|
|
|
: Colors.teal[100]!, |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
child: Icon( |
|
|
|
Icons.record_voice_over, |
|
|
|
size: 16.w, |
|
|
|
color: isDarkMode ? Colors.teal[300]! : Colors.teal[600]!, |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(width: 12.w), |
|
|
|
Flexible( |
|
|
|
//语音服务标题和副标题 |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
'voiceService'.tr, // 语音服务 |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: 2.h), |
|
|
|
Text( |
|
|
|
'voiceServiceInfo'.tr, // 选择语音识别和合成服务 |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.black54, |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
Row( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
children: [ |
|
|
|
Obx(() { |
|
|
|
final serviceType = controller.speechServiceType.value; |
|
|
|
final serviceName = controller.availableSpeechServices |
|
|
|
.firstWhere((service) => service['type'] == serviceType, |
|
|
|
orElse: () => {'name': 'unknown'})['name']; |
|
|
|
return Container( |
|
|
|
constraints: BoxConstraints(maxWidth: 120.w), // 限制最大宽度 |
|
|
|
child: Text( |
|
|
|
'$serviceName'.tr, // 语音服务名称 |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[600], |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
); |
|
|
|
}), |
|
|
|
SizedBox(width: 8.w), |
|
|
|
Container( |
|
|
|
width: 32.w, |
|
|
|
height: 32.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.05) |
|
|
|
: Colors.grey[100], |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
child: Icon( |
|
|
|
Icons.chevron_right, |
|
|
|
size: 16.w, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[500], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 显示语音服务选择对话框 |
|
|
|
void _showSpeechServiceSelectionDialog(bool isDarkMode) { |
|
|
|
Get.dialog( |
|
|
|
Dialog( |
|
|
|
backgroundColor: isDarkMode ? Colors.grey[900] : Colors.white, |
|
|
|
shape: RoundedRectangleBorder( |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
child: Padding( |
|
|
|
padding: EdgeInsets.all(16.w), |
|
|
|
child: Column( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
'selectVoiceService'.tr, // 选择语音服务 |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 18.sp, |
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: 16.h), |
|
|
|
...controller.availableSpeechServices.map((service) { |
|
|
|
return Obx(() { |
|
|
|
final isSelected = |
|
|
|
controller.speechServiceType.value == service['type']; |
|
|
|
return GestureDetector( |
|
|
|
onTap: () { |
|
|
|
controller.setSpeechServiceType(service['type']); |
|
|
|
Get.back(); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.only(bottom: 12.h), |
|
|
|
padding: EdgeInsets.all(12.w), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isSelected |
|
|
|
? (isDarkMode |
|
|
|
? Colors.teal[900]!.withOpacity(0.3) |
|
|
|
: Colors.teal[50]!) |
|
|
|
: (isDarkMode |
|
|
|
? Colors.white.withOpacity(0.05) |
|
|
|
: Colors.grey[100]!), |
|
|
|
borderRadius: BorderRadius.circular(12.r), |
|
|
|
border: Border.all( |
|
|
|
color: isSelected |
|
|
|
? (isDarkMode |
|
|
|
? Colors.teal[300]! |
|
|
|
: Colors.teal[600]!) |
|
|
|
: Colors.transparent, |
|
|
|
width: 1, |
|
|
|
), |
|
|
|
), |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
'${service['name']}'.tr, // 服务名称 |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white |
|
|
|
: Colors.black87, |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
SizedBox(height: 4.h), |
|
|
|
Text( |
|
|
|
'${service['description']}'.tr, // 服务描述 |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white70 |
|
|
|
: Colors.black54, |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
maxLines: 2, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(width: 12.w), |
|
|
|
Container( |
|
|
|
width: 24.w, |
|
|
|
height: 24.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isSelected |
|
|
|
? (isDarkMode |
|
|
|
? Colors.teal[300] |
|
|
|
: Colors.teal[600]) |
|
|
|
: (isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.grey[300]), |
|
|
|
shape: BoxShape.circle, |
|
|
|
), |
|
|
|
child: isSelected |
|
|
|
? Icon( |
|
|
|
Icons.check, |
|
|
|
size: 16.w, |
|
|
|
color: Colors.white, |
|
|
|
) |
|
|
|
: null, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
}); |
|
|
|
}).toList(), |
|
|
|
SizedBox(height: 16.h), |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.end, |
|
|
|
children: [ |
|
|
|
TextButton( |
|
|
|
onPressed: () => Get.back(), |
|
|
|
child: Text( |
|
|
|
'cancel'.tr, // 取消 |
|
|
|
style: TextStyle( |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.black54, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 显示语言选择对话框 |
|
|
|
void _showLanguageSelectionDialog(bool isDarkMode) { |
|
|
|
Get.dialog( |
|
|
|
@ -1572,10 +1129,10 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isSelected |
|
|
|
? (isDarkMode |
|
|
|
? Colors.teal[900]!.withOpacity(0.3) |
|
|
|
? Colors.teal[900]!.withValues(alpha: 0.3) |
|
|
|
: Colors.teal[50]!) |
|
|
|
: (isDarkMode |
|
|
|
? Colors.white.withOpacity(0.05) |
|
|
|
? Colors.white.withValues(alpha: 0.05) |
|
|
|
: Colors.grey[100]!), |
|
|
|
borderRadius: BorderRadius.circular(12.r), |
|
|
|
border: Border.all( |
|
|
|
@ -1621,7 +1178,8 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
? Colors.teal[300] |
|
|
|
: Colors.teal[600]) |
|
|
|
: (isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
? Colors.white |
|
|
|
.withValues(alpha: 0.1) |
|
|
|
: Colors.grey[300]), |
|
|
|
shape: BoxShape.circle, |
|
|
|
), |
|
|
|
@ -1663,78 +1221,4 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// 添加权限管理设置项 |
|
|
|
Widget _buildSettingItem({ |
|
|
|
required IconData icon, |
|
|
|
required Color iconColor, |
|
|
|
required String title, |
|
|
|
required bool isDarkMode, |
|
|
|
required VoidCallback onTap, |
|
|
|
}) { |
|
|
|
return InkWell( |
|
|
|
onTap: onTap, |
|
|
|
child: Padding( |
|
|
|
padding: EdgeInsets.all(16.w), |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: [ |
|
|
|
Expanded( |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
width: 32.w, |
|
|
|
height: 32.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.05) |
|
|
|
: Colors.grey[100], |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
child: Icon( |
|
|
|
icon, |
|
|
|
size: 16.w, |
|
|
|
color: iconColor, |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(width: 12.w), |
|
|
|
Flexible( |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
title, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
Container( |
|
|
|
width: 32.w, |
|
|
|
height: 32.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.05) |
|
|
|
: Colors.grey[100], |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
child: Icon( |
|
|
|
Icons.chevron_right, |
|
|
|
size: 16.w, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[500], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|