Browse Source

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

- 校验音频时长有效性,防止无效值导致格式化函数异常,异常时重置为0并打印警告
- 调整暗黑模式下设置页容器背景色、边框及阴影,提升视觉效果一致性
- 重构设置界面布局,移除BackdropFilter模糊效果,避免暗黑模式下渲染问题
- 优化语言、主题、用户反馈等设置项颜色及交互,完善暗黑模式支持
- 修复版本号文本颜色错乱,适配暗黑与明亮主题
- 调整更新检查按钮视觉样式,确保在不同主题下清晰可见
- 注释和调整部分测试及调试功能入口,清理无用代码,保持界面简洁
newdev_shunjiawei
lxm 7 months ago
parent
commit
25c6763387
  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); 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); 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, height: 32.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDarkMode color: isDarkMode
? Colors.white.withValues(alpha: 0.1) ? const Color(0xFF2C2C2C)
: Colors.white.withValues(alpha: 0.7), : Colors.white.withValues(alpha: 0.7),
borderRadius: BorderRadius.circular(16.r), borderRadius: BorderRadius.circular(16.r),
boxShadow: [ boxShadow: [
@ -371,319 +371,313 @@ class SettingsView extends GetView<SettingsController> {
// ), // ),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDarkMode color: isDarkMode ? const Color(0xFF1E1E1E) : Colors.white,
? Colors.white.withValues(alpha: 0.05)
: Colors.white,
borderRadius: BorderRadius.circular(16.r), borderRadius: BorderRadius.circular(16.r),
border: isDarkMode
? Border.all(color: const Color(0xFF2C2C2C), width: 1)
: null,
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: isDarkMode color: isDarkMode
? Colors.black.withValues(alpha: 0.2) ? Colors.black.withValues(alpha: 0.4)
: Colors.black.withValues(alpha: 0.05), : Colors.black.withValues(alpha: 0.06),
blurRadius: 10, blurRadius: 12,
offset: const Offset(0, 2), offset: const Offset(0, 2),
), ),
], ],
), ),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(16.r), borderRadius: BorderRadius.circular(16.r),
child: BackdropFilter( child: Column(
filter: isDarkMode children: [
? ImageFilter.blur(sigmaX: 5, sigmaY: 5) // 语言设置
: ImageFilter.blur(sigmaX: 0, sigmaY: 0), Obx(
child: Column( () => _buildSimpleNavigationSetting(
children: [ title: 'languageSetting'.tr, // 语言设置
// 语言设置 subtitle: controller.currentLanguage.value.name.tr, // 当前语言
Obx( icon: Icons.language,
() => _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,
iconBgColor: isDarkMode iconBgColor: isDarkMode
? Colors.indigo[900]!.withValues(alpha: 0.3) ? Colors.indigo[900]!.withValues(alpha: 0.3)
: Colors.amber[100]!, : Colors.indigo[100]!,
iconColor: iconColor:
isDarkMode ? Colors.indigo[300]! : Colors.amber[600]!, isDarkMode ? Colors.indigo[300]! : Colors.indigo[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]!,
titleColor: isDarkMode ? Colors.white : null, titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null, subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () { onTap: () {
// 打开反馈页面 _showLanguageSelectionDialog(isDarkMode);
Get.toNamed(Routes.feedback);
}, },
isDarkMode: isDarkMode, isDarkMode: isDarkMode,
), ),
// if (Platform.isAndroid) ...[ ),
// Divider( Divider(
// height: 1, height: 1,
// color: isDarkMode color: isDarkMode
// ? Colors.white.withOpacity(0.1) ? const Color(0xFF2C2C2C)
// : Colors.grey[200]), : Colors.grey[200]),
// // 隐私设置 // 主题设置
// _buildSimpleNavigationSetting( _buildToggleSetting(
// title: 'privacySettings'.tr, // 隐私设置 title: 'darkMode'.tr, // 暗黑模式
// subtitle: 'privacySettingsInfo'.tr, // 管理数据收集和权限 subtitle: 'darkModeInfo'.tr, // 切换应用的明暗主题
// icon: Icons.shield_outlined, icon: isDarkMode ? Icons.dark_mode : Icons.light_mode,
// iconBgColor: isDarkMode iconBgColor: isDarkMode
// ? Colors.purple[900]!.withOpacity(0.3) ? Colors.indigo[900]!.withValues(alpha: 0.3)
// : Colors.purple[100]!, : Colors.amber[100]!,
// iconColor: iconColor:
// isDarkMode ? Colors.purple[300]! : Colors.purple[600]!, isDarkMode ? Colors.indigo[300]! : Colors.amber[600]!,
// titleColor: isDarkMode ? Colors.white : null, value: isDarkMode,
// subtitleColor: isDarkMode ? Colors.white70 : null, onChanged: (isThemeChanged) {
// onTap: () { controller.toggleTheme();
// AppSettings.openAppSettings(); },
// }, isDarkMode: isDarkMode,
// isDarkMode: isDarkMode, ),
// ), Divider(
// ], height: 1,
color: isDarkMode
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
Divider( // 用户反馈
height: 1, _buildSimpleNavigationSetting(
color: isDarkMode title: 'feedback'.tr, // 用户反馈
? Colors.white.withValues(alpha: 0.1) subtitle: 'feedbackInfo'.tr, // 提供反馈或建议
: Colors.grey[200]), 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( // _buildSimpleNavigationSetting(
title: 'deviceManagement'.tr, // 设备管理 // title: 'privacySettings'.tr, // 隐私设置
subtitle: 'manageConnectedDevices'.tr, // 管理已绑定的蓝牙设备 // subtitle: 'privacySettingsInfo'.tr, // 管理数据收集和权限
icon: Icons.device_hub, // icon: Icons.shield_outlined,
iconBgColor: isDarkMode // iconBgColor: isDarkMode
? Colors.red[900]!.withValues(alpha: 0.3) // ? Colors.purple[900]!.withOpacity(0.3)
: Colors.red[100]!, // : Colors.purple[100]!,
iconColor: isDarkMode ? Colors.red[300]! : Colors.red[600]!, // iconColor:
titleColor: isDarkMode ? Colors.white : null, // isDarkMode ? Colors.purple[300]! : Colors.purple[600]!,
subtitleColor: isDarkMode ? Colors.white70 : null, // titleColor: isDarkMode ? Colors.white : null,
onTap: () => Get.toNamed(Routes.devices), // subtitleColor: isDarkMode ? Colors.white70 : null,
isDarkMode: isDarkMode, // onTap: () {
), // AppSettings.openAppSettings();
Divider( // },
height: 1, // isDarkMode: isDarkMode,
color: isDarkMode // ),
? Colors.white.withValues(alpha: 0.1) // ],
: Colors.grey[200]),
// // 杰理测试 Divider(
// _buildSimpleNavigationSetting( height: 1,
// title: '杰理蓝牙测试', color: isDarkMode
// subtitle: '测试杰理蓝牙设备扫描、连接和功能', ? const Color(0xFF2C2C2C)
// icon: Icons.bluetooth, : Colors.grey[200]),
// 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测试
// 支付测试 // 配对设备管理
// _buildSimpleNavigationSetting( _buildSimpleNavigationSetting(
// title: '支付测试', title: 'deviceManagement'.tr, // 设备管理
// subtitle: '测试微信支付功能', subtitle: 'manageConnectedDevices'.tr, // 管理已绑定的蓝牙设备
// icon: Icons.payment, icon: Icons.device_hub,
// iconBgColor: isDarkMode iconBgColor: isDarkMode
// ? Colors.green[900]!.withOpacity(0.3) ? Colors.red[900]!.withValues(alpha: 0.3)
// : Colors.green[100]!, : Colors.red[100]!,
// iconColor: iconColor: isDarkMode ? Colors.red[300]! : Colors.red[600]!,
// isDarkMode ? Colors.green[300]! : Colors.green[600]!, titleColor: isDarkMode ? Colors.white : null,
// titleColor: isDarkMode ? Colors.white : null, subtitleColor: isDarkMode ? Colors.white70 : null,
// subtitleColor: isDarkMode ? Colors.white70 : null, onTap: () => Get.toNamed(Routes.devices),
// onTap: () { isDarkMode: isDarkMode,
// Get.toNamed(Routes.payment); ),
// }, Divider(
// isDarkMode: isDarkMode, height: 1,
// ), color: isDarkMode
// Divider( ? const Color(0xFF2C2C2C)
// height: 1, : Colors.grey[200]),
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
Obx(() => controller.showDebugInfo.value // // 杰理测试
? _buildSimpleNavigationSetting( // _buildSimpleNavigationSetting(
title: 'opus解码测试', // title: '杰理蓝牙测试',
subtitle: '测试opus解码', // subtitle: '测试杰理蓝牙设备扫描、连接和功能',
icon: Icons.bluetooth_searching, // icon: Icons.bluetooth,
iconBgColor: isDarkMode // iconBgColor: isDarkMode
? Colors.green[900]!.withValues(alpha: 0.3) // ? Colors.blue[900]!.withOpacity(0.3)
: Colors.green[100]!, // : Colors.blue[100]!,
iconColor: isDarkMode // iconColor:
? Colors.green[300]! // isDarkMode ? Colors.blue[300]! : Colors.blue[600]!,
: Colors.green[600]!, // titleColor: isDarkMode ? Colors.white : null,
titleColor: isDarkMode ? Colors.white : null, // subtitleColor: isDarkMode ? Colors.white70 : null,
subtitleColor: isDarkMode ? Colors.white70 : null, // onTap: () {
onTap: () { // Get.toNamed(Routes.jieliTest);
Get.toNamed(Routes.opusTest); // },
}, // isDarkMode: isDarkMode,
isDarkMode: isDarkMode, // ),
) // Divider(
: const SizedBox.shrink()), // height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// //BLE测试
// Divider( // 支付测试
// height: 1, // _buildSimpleNavigationSetting(
// color: isDarkMode // title: '支付测试',
// ? Colors.white.withOpacity(0.1) // subtitle: '测试微信支付功能',
// : Colors.grey[200]), // 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测试 Obx(() => controller.showDebugInfo.value
// _buildSimpleNavigationSetting( ? _buildSimpleNavigationSetting(
// title: 'BLE蓝牙测试', title: 'opus解码测试',
// subtitle: '测试BLE蓝牙设备扫描、连接和功能', subtitle: '测试opus解码',
// icon: Icons.bluetooth_searching, icon: Icons.bluetooth_searching,
// iconBgColor: isDarkMode iconBgColor: isDarkMode
// ? Colors.green[900]!.withOpacity(0.3) ? Colors.green[900]!.withValues(alpha: 0.3)
// : Colors.green[100]!, : Colors.green[100]!,
// iconColor: iconColor: isDarkMode
// isDarkMode ? Colors.green[300]! : Colors.green[600]!, ? Colors.green[300]!
// titleColor: isDarkMode ? Colors.white : null, : Colors.green[600]!,
// subtitleColor: isDarkMode ? Colors.white70 : null, titleColor: isDarkMode ? Colors.white : null,
// onTap: () { subtitleColor: isDarkMode ? Colors.white70 : null,
// Get.toNamed(Routes.bleTest); onTap: () {
// }, Get.toNamed(Routes.opusTest);
// isDarkMode: isDarkMode, },
// ), isDarkMode: isDarkMode,
// Divider( )
// height: 1, : const SizedBox.shrink()),
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// // 火山语音测试 // Divider(
// _buildSimpleNavigationSetting( // height: 1,
// title: '语音测试', // color: isDarkMode
// subtitle: '测试语音识别和合成功能,支持多种服务实现', // ? Colors.white.withOpacity(0.1)
// icon: Icons.record_voice_over, // : Colors.grey[200]),
// 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) ...[ // BLE测试
Divider( // _buildSimpleNavigationSetting(
height: 1, // title: 'BLE蓝牙测试',
color: isDarkMode // subtitle: '测试BLE蓝牙设备扫描、连接和功能',
? Colors.white.withValues(alpha: 0.1) // icon: Icons.bluetooth_searching,
: Colors.grey[200]), // 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( // _buildSimpleNavigationSetting(
title: 'permissionManagement'.tr, // 权限管理 // title: '语音测试',
subtitle: 'permissionManagementInfo'.tr, // 管理应用权限设置 // subtitle: '测试语音识别和合成功能,支持多种服务实现',
icon: Icons.security, // icon: Icons.record_voice_over,
iconBgColor: isDarkMode // iconBgColor: isDarkMode
? Colors.orange[900]!.withValues(alpha: 0.3) // ? Colors.orange[900]!.withOpacity(0.3)
: Colors.orange[100]!, // : Colors.orange[100]!,
iconColor: // iconColor:
isDarkMode ? Colors.orange[300]! : Colors.orange[600]!, // isDarkMode ? Colors.orange[300]! : Colors.orange[600]!,
titleColor: isDarkMode ? Colors.white : null, // onTap: () => Get.toNamed(Routes.speechTest),
subtitleColor: isDarkMode ? Colors.white70 : null, // isDarkMode: isDarkMode,
onTap: () { // ),
Get.toNamed(Routes.permissions); // Divider(
}, // height: 1,
isDarkMode: isDarkMode, // 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( Container(
padding: EdgeInsets.all(16.w), padding: EdgeInsets.all(16.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDarkMode color: isDarkMode ? const Color(0xFF1E1E1E) : Colors.white,
? Colors.white.withValues(alpha: 0.05)
: Colors.white,
borderRadius: BorderRadius.circular(16.r), borderRadius: BorderRadius.circular(16.r),
border: isDarkMode
? Border.all(color: const Color(0xFF2C2C2C), width: 1)
: null,
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: isDarkMode color: isDarkMode
? Colors.black.withValues(alpha: 0.2) ? Colors.black.withValues(alpha: 0.4)
: Colors.black.withValues(alpha: 0.05), : Colors.black.withValues(alpha: 0.06),
blurRadius: 10, blurRadius: 12,
offset: const Offset(0, 2), offset: const Offset(0, 2),
), ),
], ],
), ),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: BackdropFilter( child: Row(
filter: isDarkMode children: [
? ImageFilter.blur(sigmaX: 5, sigmaY: 5) // 左侧应用信息区域 - 使用固定宽度
: ImageFilter.blur(sigmaX: 0, sigmaY: 0), Row(
child: Row( children: [
children: [ GestureDetector(
// 左侧应用信息区域 - 使用固定宽度 onTap: controller.handleSecretTap, // 点击事件
Row( child: Container(
children: [ width: 40.w,
GestureDetector( height: 40.w,
onTap: controller.handleSecretTap, // 点击事件 decoration: BoxDecoration(
child: Container( gradient: LinearGradient(
width: 40.w, colors: [
height: 40.w, const Color(0xFF2196F3)
decoration: BoxDecoration( .withValues(alpha: isDarkMode ? 0.7 : 1.0),
gradient: LinearGradient( const Color(0xFF9C27B0)
colors: [ .withValues(alpha: isDarkMode ? 0.7 : 1.0)
const Color(0xFF2196F3) ],
.withValues(alpha: isDarkMode ? 0.7 : 1.0), begin: Alignment.topLeft,
const Color(0xFF9C27B0) end: Alignment.bottomRight,
.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,
), ),
borderRadius: BorderRadius.circular(12.r),
),
child: Icon(
Icons.headphones,
size: 24.w,
color: Colors.white,
), ),
), ),
SizedBox(width: 12.w), ),
Column( SizedBox(width: 12.w),
crossAxisAlignment: CrossAxisAlignment.start, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Text( children: [
'Voitrans', Text(
style: TextStyle( 'Voitrans',
fontSize: 16.sp, style: TextStyle(
fontWeight: FontWeight.w500, fontSize: 16.sp,
color: isDarkMode ? Colors.white : Colors.black87, 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( SizedBox(height: 2.h),
horizontal: 12.w, Obx(() => Text(
vertical: 8.h, // 如果版本信息为空,显示加载中
), controller.appVersion.value.isEmpty
decoration: BoxDecoration( ? '${'versions'.tr} ${'loading'.tr}' // 版本 加载中
color: isDarkMode : '${'versions'.tr} ${controller.appVersion.value} (Build ${controller.buildNumber.value})', // 版本号
? 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( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
color: isDarkMode color:
? Colors.blue[300] isDarkMode ? Colors.white70 : Colors.black54,
: Colors.blue[600],
height: 1.2, // 稍微减少行高,适应FittedBox
), ),
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), SizedBox(height: 16.h),

Loading…
Cancel
Save