Browse Source

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

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

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

@ -217,9 +217,17 @@ class MeetingDetailsController extends GetxController
// 获取音频时长
final duration = await playerController.getDuration(DurationType.max);
// 校验时长有效性,防止无效值导致 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);

61
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,41 +371,36 @@ 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, // 当前语言
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]!,
iconColor:
isDarkMode ? Colors.indigo[300]! : Colors.indigo[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () {
@ -417,7 +412,7 @@ class SettingsView extends GetView<SettingsController> {
Divider(
height: 1,
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
// 主题设置
@ -439,7 +434,7 @@ class SettingsView extends GetView<SettingsController> {
Divider(
height: 1,
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
// 用户反馈
@ -489,7 +484,7 @@ class SettingsView extends GetView<SettingsController> {
Divider(
height: 1,
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
// 配对设备管理
@ -509,7 +504,7 @@ class SettingsView extends GetView<SettingsController> {
Divider(
height: 1,
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
// // 杰理测试
@ -661,7 +656,7 @@ class SettingsView extends GetView<SettingsController> {
Divider(
height: 1,
color: isDarkMode
? Colors.white.withValues(alpha: 0.1)
? const Color(0xFF2C2C2C)
: Colors.grey[200]),
// 权限管理设置项
@ -686,7 +681,6 @@ class SettingsView extends GetView<SettingsController> {
),
),
),
),
],
);
}
@ -711,25 +705,22 @@ 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: [
// 左侧应用信息区域 - 使用固定宽度
@ -780,9 +771,8 @@ class SettingsView extends GetView<SettingsController> {
: '${'versions'.tr} ${controller.appVersion.value} (Build ${controller.buildNumber.value})', // 版本号
style: TextStyle(
fontSize: 12.sp,
color: isDarkMode
? Colors.white70
: Colors.black54,
color:
isDarkMode ? Colors.white70 : Colors.black54,
),
)),
],
@ -837,7 +827,6 @@ class SettingsView extends GetView<SettingsController> {
],
),
),
),
SizedBox(height: 16.h),
Center(
child: Column(

Loading…
Cancel
Save