Browse Source

fix(settings): 修复设置页暗黑模式样式及音频时长验证

- 校验音频时长有效性,防止无效值导致格式化函数异常,异常时重置为0并打印警告
- 调整暗黑模式下设置页容器背景色、边框及阴影,提升视觉效果一致性
- 重构设置界面布局,移除BackdropFilter模糊效果,避免暗黑模式下渲染问题
- 优化语言、主题、用户反馈等设置项颜色及交互,完善暗黑模式支持
- 修复版本号文本颜色错乱,适配暗黑与明亮主题
- 调整更新检查按钮视觉样式,确保在不同主题下清晰可见
- 注释和调整部分测试及调试功能入口,清理无用代码,保持界面简洁
weicu
lxm 7 months ago
parent
commit
222b483bd8
  1. 12
      lib/modules/meeting/controllers/meeting_details_controller.dart
  2. 761
      lib/modules/settings/views/settings_view.dart

12
lib/modules/meeting/controllers/meeting_details_controller.dart

@ -217,9 +217,17 @@ class MeetingDetailsController extends GetxController
// 获取音频时长
final duration = await playerController.getDuration(DurationType.max);
durationMax.value = duration;
// 校验时长有效性,防止无效值导致 DateUtil.formatDateMs 报错
// 有效的毫秒时间戳应该在合理范围内(大于0且小于未来100年)
const int maxValidDuration = 315360000000; // 约10年的毫秒数
if (duration > 0 && duration < maxValidDuration) {
durationMax.value = duration;
} else {
durationMax.value = 0;
Logger.w('MeetingDetails', '获取到无效的音频时长: $duration,已重置为0');
}
Logger.d('MeetingDetails', '音频播放器加载成功,时长: ${duration}ms');
Logger.d('MeetingDetails', '音频播放器加载成功,时长: ${durationMax.value}ms');
// 设置播放完成模式
playerController.setFinishMode(finishMode: FinishMode.pause);

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

@ -185,7 +185,7 @@ class SettingsView extends GetView<SettingsController> {
height: 32.w,
decoration: BoxDecoration(
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
? const Color(0xFF2C2C2C)
: Colors.white.withValues(alpha: 0.7),
borderRadius: BorderRadius.circular(16.r),
boxShadow: [
@ -371,319 +371,313 @@ class SettingsView extends GetView<SettingsController> {
// ),
Container(
decoration: BoxDecoration(
color: isDarkMode
? Colors.white.withValues(alpha: 0.05)
: Colors.white,
color: isDarkMode ? const Color(0xFF1E1E1E) : Colors.white,
borderRadius: BorderRadius.circular(16.r),
border: isDarkMode
? Border.all(color: const Color(0xFF2C2C2C), width: 1)
: null,
boxShadow: [
BoxShadow(
color: isDarkMode
? Colors.black.withValues(alpha: 0.2)
: Colors.black.withValues(alpha: 0.05),
blurRadius: 10,
? Colors.black.withValues(alpha: 0.4)
: Colors.black.withValues(alpha: 0.06),
blurRadius: 12,
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: [
// 语言设置
Obx(
() => _buildSimpleNavigationSetting(
title: 'languageSetting'.tr, // 语言设置
subtitle:
controller.currentLanguage.value.name.tr, // 当前语言
icon: Icons.language,
iconBgColor: isDarkMode
? Colors.indigo[900]!.withValues(alpha: 0.3)
: Colors.indigo[100]!,
iconColor: isDarkMode
? Colors.indigo[300]!
: Colors.indigo[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () {
_showLanguageSelectionDialog(isDarkMode);
},
isDarkMode: isDarkMode,
),
),
Divider(
height: 1,
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
: Colors.grey[200]),
// 主题设置
_buildToggleSetting(
title: 'darkMode'.tr, // 暗黑模式
subtitle: 'darkModeInfo'.tr, // 切换应用的明暗主题
icon: isDarkMode ? Icons.dark_mode : Icons.light_mode,
child: Column(
children: [
// 语言设置
Obx(
() => _buildSimpleNavigationSetting(
title: 'languageSetting'.tr, // 语言设置
subtitle: controller.currentLanguage.value.name.tr, // 当前语言
icon: Icons.language,
iconBgColor: isDarkMode
? Colors.indigo[900]!.withValues(alpha: 0.3)
: Colors.amber[100]!,
: Colors.indigo[100]!,
iconColor:
isDarkMode ? Colors.indigo[300]! : Colors.amber[600]!,
value: isDarkMode,
onChanged: (isThemeChanged) {
controller.toggleTheme();
},
isDarkMode: isDarkMode,
),
Divider(
height: 1,
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
: Colors.grey[200]),
// 用户反馈
_buildSimpleNavigationSetting(
title: 'feedback'.tr, // 用户反馈
subtitle: 'feedbackInfo'.tr, // 提供反馈或建议
icon: Icons.feedback_outlined,
iconBgColor: isDarkMode
? Colors.orange[900]!.withValues(alpha: 0.3)
: Colors.orange[100]!,
iconColor:
isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
isDarkMode ? Colors.indigo[300]! : Colors.indigo[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () {
// 打开反馈页面
Get.toNamed(Routes.feedback);
_showLanguageSelectionDialog(isDarkMode);
},
isDarkMode: isDarkMode,
),
// if (Platform.isAndroid) ...[
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
),
Divider(
height: 1,
color: isDarkMode
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
// // 隐私设置
// _buildSimpleNavigationSetting(
// title: 'privacySettings'.tr, // 隐私设置
// subtitle: 'privacySettingsInfo'.tr, // 管理数据收集和权限
// icon: Icons.shield_outlined,
// 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: () {
// AppSettings.openAppSettings();
// },
// isDarkMode: isDarkMode,
// ),
// ],
// 主题设置
_buildToggleSetting(
title: 'darkMode'.tr, // 暗黑模式
subtitle: 'darkModeInfo'.tr, // 切换应用的明暗主题
icon: isDarkMode ? Icons.dark_mode : Icons.light_mode,
iconBgColor: isDarkMode
? Colors.indigo[900]!.withValues(alpha: 0.3)
: Colors.amber[100]!,
iconColor:
isDarkMode ? Colors.indigo[300]! : Colors.amber[600]!,
value: isDarkMode,
onChanged: (isThemeChanged) {
controller.toggleTheme();
},
isDarkMode: isDarkMode,
),
Divider(
height: 1,
color: isDarkMode
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
Divider(
height: 1,
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
: Colors.grey[200]),
// 用户反馈
_buildSimpleNavigationSetting(
title: 'feedback'.tr, // 用户反馈
subtitle: 'feedbackInfo'.tr, // 提供反馈或建议
icon: Icons.feedback_outlined,
iconBgColor: isDarkMode
? Colors.orange[900]!.withValues(alpha: 0.3)
: Colors.orange[100]!,
iconColor:
isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () {
// 打开反馈页面
Get.toNamed(Routes.feedback);
},
isDarkMode: isDarkMode,
),
// if (Platform.isAndroid) ...[
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// 配对设备管理
_buildSimpleNavigationSetting(
title: 'deviceManagement'.tr, // 设备管理
subtitle: 'manageConnectedDevices'.tr, // 管理已绑定的蓝牙设备
icon: Icons.device_hub,
iconBgColor: isDarkMode
? Colors.red[900]!.withValues(alpha: 0.3)
: Colors.red[100]!,
iconColor: isDarkMode ? Colors.red[300]! : Colors.red[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () => Get.toNamed(Routes.devices),
isDarkMode: isDarkMode,
),
Divider(
height: 1,
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
: Colors.grey[200]),
// // 隐私设置
// _buildSimpleNavigationSetting(
// title: 'privacySettings'.tr, // 隐私设置
// subtitle: 'privacySettingsInfo'.tr, // 管理数据收集和权限
// icon: Icons.shield_outlined,
// 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: () {
// AppSettings.openAppSettings();
// },
// isDarkMode: isDarkMode,
// ),
// ],
// // 杰理测试
// _buildSimpleNavigationSetting(
// title: '杰理蓝牙测试',
// subtitle: '测试杰理蓝牙设备扫描、连接和功能',
// icon: Icons.bluetooth,
// iconBgColor: isDarkMode
// ? Colors.blue[900]!.withOpacity(0.3)
// : Colors.blue[100]!,
// iconColor:
// isDarkMode ? Colors.blue[300]! : Colors.blue[600]!,
// titleColor: isDarkMode ? Colors.white : null,
// subtitleColor: isDarkMode ? Colors.white70 : null,
// onTap: () {
// Get.toNamed(Routes.jieliTest);
// },
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// //BLE测试
Divider(
height: 1,
color: isDarkMode
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
// 支付测试
// _buildSimpleNavigationSetting(
// title: '支付测试',
// subtitle: '测试微信支付功能',
// icon: Icons.payment,
// iconBgColor: isDarkMode
// ? Colors.green[900]!.withOpacity(0.3)
// : Colors.green[100]!,
// iconColor:
// isDarkMode ? Colors.green[300]! : Colors.green[600]!,
// titleColor: isDarkMode ? Colors.white : null,
// subtitleColor: isDarkMode ? Colors.white70 : null,
// onTap: () {
// Get.toNamed(Routes.payment);
// },
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// 配对设备管理
_buildSimpleNavigationSetting(
title: 'deviceManagement'.tr, // 设备管理
subtitle: 'manageConnectedDevices'.tr, // 管理已绑定的蓝牙设备
icon: Icons.device_hub,
iconBgColor: isDarkMode
? Colors.red[900]!.withValues(alpha: 0.3)
: Colors.red[100]!,
iconColor: isDarkMode ? Colors.red[300]! : Colors.red[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () => Get.toNamed(Routes.devices),
isDarkMode: isDarkMode,
),
Divider(
height: 1,
color: isDarkMode
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
Obx(() => controller.showDebugInfo.value
? _buildSimpleNavigationSetting(
title: 'opus解码测试',
subtitle: '测试opus解码',
icon: Icons.bluetooth_searching,
iconBgColor: isDarkMode
? Colors.green[900]!.withValues(alpha: 0.3)
: Colors.green[100]!,
iconColor: isDarkMode
? Colors.green[300]!
: Colors.green[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () {
Get.toNamed(Routes.opusTest);
},
isDarkMode: isDarkMode,
)
: const SizedBox.shrink()),
// // 杰理测试
// _buildSimpleNavigationSetting(
// title: '杰理蓝牙测试',
// subtitle: '测试杰理蓝牙设备扫描、连接和功能',
// icon: Icons.bluetooth,
// iconBgColor: isDarkMode
// ? Colors.blue[900]!.withOpacity(0.3)
// : Colors.blue[100]!,
// iconColor:
// isDarkMode ? Colors.blue[300]! : Colors.blue[600]!,
// titleColor: isDarkMode ? Colors.white : null,
// subtitleColor: isDarkMode ? Colors.white70 : null,
// onTap: () {
// Get.toNamed(Routes.jieliTest);
// },
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// //BLE测试
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// 支付测试
// _buildSimpleNavigationSetting(
// title: '支付测试',
// subtitle: '测试微信支付功能',
// icon: Icons.payment,
// iconBgColor: isDarkMode
// ? Colors.green[900]!.withOpacity(0.3)
// : Colors.green[100]!,
// iconColor:
// isDarkMode ? Colors.green[300]! : Colors.green[600]!,
// titleColor: isDarkMode ? Colors.white : null,
// subtitleColor: isDarkMode ? Colors.white70 : null,
// onTap: () {
// Get.toNamed(Routes.payment);
// },
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// BLE测试
// _buildSimpleNavigationSetting(
// title: 'BLE蓝牙测试',
// subtitle: '测试BLE蓝牙设备扫描、连接和功能',
// icon: Icons.bluetooth_searching,
// iconBgColor: isDarkMode
// ? Colors.green[900]!.withOpacity(0.3)
// : Colors.green[100]!,
// iconColor:
// isDarkMode ? Colors.green[300]! : Colors.green[600]!,
// titleColor: isDarkMode ? Colors.white : null,
// subtitleColor: isDarkMode ? Colors.white70 : null,
// onTap: () {
// Get.toNamed(Routes.bleTest);
// },
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
Obx(() => controller.showDebugInfo.value
? _buildSimpleNavigationSetting(
title: 'opus解码测试',
subtitle: '测试opus解码',
icon: Icons.bluetooth_searching,
iconBgColor: isDarkMode
? Colors.green[900]!.withValues(alpha: 0.3)
: Colors.green[100]!,
iconColor: isDarkMode
? Colors.green[300]!
: Colors.green[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () {
Get.toNamed(Routes.opusTest);
},
isDarkMode: isDarkMode,
)
: const SizedBox.shrink()),
// // 火山语音测试
// _buildSimpleNavigationSetting(
// title: '语音测试',
// subtitle: '测试语音识别和合成功能,支持多种服务实现',
// icon: Icons.record_voice_over,
// iconBgColor: isDarkMode
// ? Colors.orange[900]!.withOpacity(0.3)
// : Colors.orange[100]!,
// iconColor:
// isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
// onTap: () => Get.toNamed(Routes.speechTest),
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// 耳机唤醒词设置
// _buildSimpleNavigationSetting(
// title: '唤醒词'.tr, // 唤醒词设置
// subtitle: '唤醒词管理'.tr, // 唤醒词管理
// icon: Icons.voice_chat,
// iconBgColor: isDarkMode
// ? Colors.orange[900]!.withOpacity(0.3)
// : Colors.orange[100]!,
// iconColor:
// isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
// onTap: () => Get.toNamed(Routes.wakeupvoice),
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
_buildSimpleNavigationSetting(
title: 'firmwareUpgrade'.tr, // 固件升级
subtitle: 'bleHeadsetFirmwareUpgrade'.tr, // BLE耳机固件版本升级
icon: Icons.system_update_alt,
iconBgColor: isDarkMode
? Colors.orange[900]!.withValues(alpha: 0.3)
: Colors.orange[100]!,
iconColor:
isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
onTap: () => Get.toNamed(Routes.OTA_UPGRADE),
isDarkMode: isDarkMode,
),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// if (Platform.isAndroid) ...[
Divider(
height: 1,
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
: Colors.grey[200]),
// BLE测试
// _buildSimpleNavigationSetting(
// title: 'BLE蓝牙测试',
// subtitle: '测试BLE蓝牙设备扫描、连接和功能',
// icon: Icons.bluetooth_searching,
// iconBgColor: isDarkMode
// ? Colors.green[900]!.withOpacity(0.3)
// : Colors.green[100]!,
// iconColor:
// isDarkMode ? Colors.green[300]! : Colors.green[600]!,
// titleColor: isDarkMode ? Colors.white : null,
// subtitleColor: isDarkMode ? Colors.white70 : null,
// onTap: () {
// Get.toNamed(Routes.bleTest);
// },
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// 权限管理设置项
_buildSimpleNavigationSetting(
title: 'permissionManagement'.tr, // 权限管理
subtitle: 'permissionManagementInfo'.tr, // 管理应用权限设置
icon: Icons.security,
iconBgColor: isDarkMode
? Colors.orange[900]!.withValues(alpha: 0.3)
: Colors.orange[100]!,
iconColor:
isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () {
Get.toNamed(Routes.permissions);
},
isDarkMode: isDarkMode,
),
// ]
],
),
// // 火山语音测试
// _buildSimpleNavigationSetting(
// title: '语音测试',
// subtitle: '测试语音识别和合成功能,支持多种服务实现',
// icon: Icons.record_voice_over,
// iconBgColor: isDarkMode
// ? Colors.orange[900]!.withOpacity(0.3)
// : Colors.orange[100]!,
// iconColor:
// isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
// onTap: () => Get.toNamed(Routes.speechTest),
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// 耳机唤醒词设置
// _buildSimpleNavigationSetting(
// title: '唤醒词'.tr, // 唤醒词设置
// subtitle: '唤醒词管理'.tr, // 唤醒词管理
// icon: Icons.voice_chat,
// iconBgColor: isDarkMode
// ? Colors.orange[900]!.withOpacity(0.3)
// : Colors.orange[100]!,
// iconColor:
// isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
// onTap: () => Get.toNamed(Routes.wakeupvoice),
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
_buildSimpleNavigationSetting(
title: 'firmwareUpgrade'.tr, // 固件升级
subtitle: 'bleHeadsetFirmwareUpgrade'.tr, // BLE耳机固件版本升级
icon: Icons.system_update_alt,
iconBgColor: isDarkMode
? Colors.orange[900]!.withValues(alpha: 0.3)
: Colors.orange[100]!,
iconColor:
isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
onTap: () => Get.toNamed(Routes.OTA_UPGRADE),
isDarkMode: isDarkMode,
),
// if (Platform.isAndroid) ...[
Divider(
height: 1,
color: isDarkMode
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
// 权限管理设置项
_buildSimpleNavigationSetting(
title: 'permissionManagement'.tr, // 权限管理
subtitle: 'permissionManagementInfo'.tr, // 管理应用权限设置
icon: Icons.security,
iconBgColor: isDarkMode
? Colors.orange[900]!.withValues(alpha: 0.3)
: Colors.orange[100]!,
iconColor:
isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () {
Get.toNamed(Routes.permissions);
},
isDarkMode: isDarkMode,
),
// ]
],
),
),
),
@ -711,131 +705,126 @@ class SettingsView extends GetView<SettingsController> {
Container(
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: isDarkMode
? Colors.white.withValues(alpha: 0.05)
: Colors.white,
color: isDarkMode ? const Color(0xFF1E1E1E) : Colors.white,
borderRadius: BorderRadius.circular(16.r),
border: isDarkMode
? Border.all(color: const Color(0xFF2C2C2C), width: 1)
: null,
boxShadow: [
BoxShadow(
color: isDarkMode
? Colors.black.withValues(alpha: 0.2)
: Colors.black.withValues(alpha: 0.05),
blurRadius: 10,
? Colors.black.withValues(alpha: 0.4)
: Colors.black.withValues(alpha: 0.06),
blurRadius: 12,
offset: const Offset(0, 2),
),
],
),
clipBehavior: Clip.antiAlias,
child: BackdropFilter(
filter: isDarkMode
? ImageFilter.blur(sigmaX: 5, sigmaY: 5)
: ImageFilter.blur(sigmaX: 0, sigmaY: 0),
child: Row(
children: [
// 左侧应用信息区域 - 使用固定宽度
Row(
children: [
GestureDetector(
onTap: controller.handleSecretTap, // 点击事件
child: Container(
width: 40.w,
height: 40.w,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
const Color(0xFF2196F3)
.withValues(alpha: isDarkMode ? 0.7 : 1.0),
const Color(0xFF9C27B0)
.withValues(alpha: isDarkMode ? 0.7 : 1.0)
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(12.r),
),
child: Icon(
Icons.headphones,
size: 24.w,
color: Colors.white,
child: Row(
children: [
// 左侧应用信息区域 - 使用固定宽度
Row(
children: [
GestureDetector(
onTap: controller.handleSecretTap, // 点击事件
child: Container(
width: 40.w,
height: 40.w,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
const Color(0xFF2196F3)
.withValues(alpha: isDarkMode ? 0.7 : 1.0),
const Color(0xFF9C27B0)
.withValues(alpha: isDarkMode ? 0.7 : 1.0)
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(12.r),
),
child: Icon(
Icons.headphones,
size: 24.w,
color: Colors.white,
),
),
SizedBox(width: 12.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Voitrans',
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w500,
color: isDarkMode ? Colors.white : Colors.black87,
),
),
SizedBox(width: 12.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Voitrans',
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w500,
color: isDarkMode ? Colors.white : Colors.black87,
),
SizedBox(height: 2.h),
Obx(() => Text(
// 如果版本信息为空,显示加载中
controller.appVersion.value.isEmpty
? '${'versions'.tr} ${'loading'.tr}' // 版本 加载中
: '${'versions'.tr} ${controller.appVersion.value} (Build ${controller.buildNumber.value})', // 版本号
style: TextStyle(
fontSize: 12.sp,
color: isDarkMode
? Colors.white70
: Colors.black54,
),
)),
],
),
],
),
// 间距
SizedBox(width: 16.w),
// 右侧检查更新按钮 - 使用Expanded确保充分利用剩余空间
Expanded(
child: InkWell(
onTap: () {
// 调用检查更新方法
controller.checkForUpdate();
},
child: Container(
constraints: BoxConstraints(
minHeight: 36.h, // 设置最小高度而不是宽度约束
),
padding: EdgeInsets.symmetric(
horizontal: 12.w,
vertical: 8.h,
),
decoration: BoxDecoration(
color: isDarkMode
? Colors.blue[900]!.withValues(alpha: 0.3)
: Colors.blue[100],
borderRadius: BorderRadius.circular(16.r),
),
child: Center(
child: FittedBox(
fit: BoxFit.scaleDown, // 如果文本过长,自动缩小字体
child: Text(
'checkUpdates'.tr, // 检查更新
SizedBox(height: 2.h),
Obx(() => Text(
// 如果版本信息为空,显示加载中
controller.appVersion.value.isEmpty
? '${'versions'.tr} ${'loading'.tr}' // 版本 加载中
: '${'versions'.tr} ${controller.appVersion.value} (Build ${controller.buildNumber.value})', // 版本号
style: TextStyle(
fontSize: 12.sp,
color: isDarkMode
? Colors.blue[300]
: Colors.blue[600],
height: 1.2, // 稍微减少行高,适应FittedBox
color:
isDarkMode ? Colors.white70 : Colors.black54,
),
textAlign: TextAlign.center,
maxLines: 2, // 最多显示2行,配合FittedBox使用
)),
],
),
],
),
// 间距
SizedBox(width: 16.w),
// 右侧检查更新按钮 - 使用Expanded确保充分利用剩余空间
Expanded(
child: InkWell(
onTap: () {
// 调用检查更新方法
controller.checkForUpdate();
},
child: Container(
constraints: BoxConstraints(
minHeight: 36.h, // 设置最小高度而不是宽度约束
),
padding: EdgeInsets.symmetric(
horizontal: 12.w,
vertical: 8.h,
),
decoration: BoxDecoration(
color: isDarkMode
? Colors.blue[900]!.withValues(alpha: 0.3)
: Colors.blue[100],
borderRadius: BorderRadius.circular(16.r),
),
child: Center(
child: FittedBox(
fit: BoxFit.scaleDown, // 如果文本过长,自动缩小字体
child: Text(
'checkUpdates'.tr, // 检查更新
style: TextStyle(
fontSize: 12.sp,
color: isDarkMode
? Colors.blue[300]
: Colors.blue[600],
height: 1.2, // 稍微减少行高,适应FittedBox
),
textAlign: TextAlign.center,
maxLines: 2, // 最多显示2行,配合FittedBox使用
),
),
),
),
),
],
),
),
],
),
),
SizedBox(height: 16.h),

Loading…
Cancel
Save