From cdd704d6faa50833546b04c2bd0a3dad3229e989 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Fri, 31 Oct 2025 18:07:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=B8=BB=E9=A2=98):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E9=A2=9C=E8=89=B2=E4=B8=8D=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=B9=B6=E4=BC=98=E5=8C=96=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将主页视图中的开关和图标颜色从动态主题色改为固定蓝色,确保视觉一致性 - 修复电池电量检测逻辑,增加对0%电量的判断 - 优化主页语音打断开关的布局,保持紧凑排列 --- lib/core/themes/app_theme.dart | 7 +++++++ lib/modules/home/views/home_view.dart | 9 ++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/core/themes/app_theme.dart b/lib/core/themes/app_theme.dart index b358f1f80..b1db12a87 100644 --- a/lib/core/themes/app_theme.dart +++ b/lib/core/themes/app_theme.dart @@ -5,6 +5,13 @@ class AppTheme { brightness: Brightness.light, primaryColor: Colors.blue, scaffoldBackgroundColor: Colors.white, + // colorScheme: const ColorScheme.light( + // primary: Colors.blue, // 主色:蓝色(修复:确保 colorScheme.primary 为蓝色) + // secondary: Color(0xFF5E5CE6), // 次色:紫色,与暗色主题保持一致 + // surface: Colors.white, + // background: Colors.white, + // error: Colors.redAccent, + // ), appBarTheme: const AppBarTheme( backgroundColor: Colors.blue, foregroundColor: Colors.white, diff --git a/lib/modules/home/views/home_view.dart b/lib/modules/home/views/home_view.dart index 31678e85f..6be0315bd 100644 --- a/lib/modules/home/views/home_view.dart +++ b/lib/modules/home/views/home_view.dart @@ -167,15 +167,14 @@ class HomeView extends GetView { // 中文注释:去除菜单模式,直接在同一行展示“语音打断”与开关 Obx(() => Row( mainAxisSize: MainAxisSize.min, // 中文注释:按需占宽,避免占满右侧 - mainAxisAlignment: - MainAxisAlignment.end, // 中文注释:靠右紧凑排布 + mainAxisAlignment: MainAxisAlignment.end, // 中文注释:靠右紧凑排布 children: [ Icon( controller.isTtsInterruptEnabled.value ? Icons.voice_over_off : Icons.voice_over_off_outlined, color: controller.isTtsInterruptEnabled.value - ? Theme.of(Get.context!).colorScheme.primary + ? Colors.blue : (isDarkMode ? Colors.grey[600] : Colors.grey[600]), size: 14.sp, // 中文注释:图标保持较小尺寸,减少占位 ), @@ -194,7 +193,7 @@ class HomeView extends GetView { child: Switch( value: controller.isTtsInterruptEnabled.value, onChanged: (value) => controller.toggleTtsInterrupt(), - activeColor: Theme.of(Get.context!).colorScheme.primary, + activeColor: Colors.blue, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), ), @@ -631,7 +630,7 @@ class HomeView extends GetView { batteryColor = Colors.red[600]!; } - bool isBatteryZero = batteryLevel == -1; + bool isBatteryZero = batteryLevel == -1 || batteryLevel == 0; return Expanded( child: Padding(