From 235e802466fbab8adc88b6d4301040f047754452 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Fri, 24 Oct 2025 18:18:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(translation):=20=E4=BF=AE=E5=A4=8D=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E7=AA=97=E6=8C=89=E9=92=AE=E5=9C=A8Android=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E4=B8=8A=E7=9A=84=E6=98=BE=E7=A4=BA=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构悬浮窗按钮的显示逻辑,将平台检查移到外部条件判断,避免不必要的Obx嵌套 --- .../translation/views/translation_view.dart | 44 +++++++++---------- pubspec.yaml | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/modules/translation/views/translation_view.dart b/lib/modules/translation/views/translation_view.dart index 09caa31c3..061ae5b04 100644 --- a/lib/modules/translation/views/translation_view.dart +++ b/lib/modules/translation/views/translation_view.dart @@ -207,28 +207,28 @@ class TranslationView extends GetView { return Row( children: [ // 悬浮窗切换按钮(仅在支持的模式下显示) - Obx(() { - if (Platform.isAndroid && - (controller.currentMode.value == 'call' || - controller.currentMode.value == 'audioVideo')) { - return IconButton( - icon: Icon( - controller.isFloatingWindowEnabled.value - ? Icons.picture_in_picture - : Icons.picture_in_picture_alt_outlined, - color: controller.isFloatingWindowEnabled.value - ? Colors.blue - : (isDarkMode ? Colors.white : Colors.black), - size: 24.sp, - ), - onPressed: controller.toggleFloatingWindow, - tooltip: controller.isFloatingWindowEnabled.value - ? '禁用悬浮窗' - : '启用悬浮窗', - ); - } - return const SizedBox.shrink(); - }), + if (Platform.isAndroid) + Obx(() { + if (controller.currentMode.value == 'call' || + controller.currentMode.value == 'audioVideo') { + return IconButton( + icon: Icon( + controller.isFloatingWindowEnabled.value + ? Icons.picture_in_picture + : Icons.picture_in_picture_alt_outlined, + color: controller.isFloatingWindowEnabled.value + ? Colors.blue + : (isDarkMode ? Colors.white : Colors.black), + size: 24.sp, + ), + onPressed: controller.toggleFloatingWindow, + tooltip: controller.isFloatingWindowEnabled.value + ? '禁用悬浮窗' + : '启用悬浮窗', + ); + } + return const SizedBox.shrink(); + }), IconButton( icon: Icon( Icons.radio_button_checked, diff --git a/pubspec.yaml b/pubspec.yaml index 849d1c6cb..d569d1b46 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: voitrans description: "Voitrans - AI Voice Assistant." publish_to: "none" -version: 1.0.17+46 +version: 1.0.18+53 environment: sdk: ">=3.3.0 <4.0.0"