diff --git a/lib/modules/home/views/home_view.dart b/lib/modules/home/views/home_view.dart index e1a68c9a1..e0350d376 100644 --- a/lib/modules/home/views/home_view.dart +++ b/lib/modules/home/views/home_view.dart @@ -271,7 +271,7 @@ class HomeView extends GetView { ), ], ), - padding: EdgeInsets.all(16.w), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), child: Column( children: [ // 状态标题行 @@ -294,7 +294,7 @@ class HomeView extends GetView { if (!controller.isFullyConnectedRx.value) { return _buildConnectButton(); } else { - return const SizedBox(); + return _buildDeviceButton(isDarkMode); } }), ], @@ -417,12 +417,42 @@ class HomeView extends GetView { ), SizedBox(height: 12.h), _buildBatteryInfoGrid(isDarkMode), - // SizedBox(height: 16.h), - // _buildDeviceDetailsCard(isDarkMode), ], ); } + // 设备管理按钮 + Widget _buildDeviceButton(bool isDarkMode) { + return ElevatedButton( + onPressed: () { + Get.toNamed(Routes.devices); // 跳转到设备管理页面 + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.blue, + foregroundColor: Colors.white, + minimumSize: Size(double.infinity, 44.h), + elevation: 2, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.r), + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.device_hub, size: 16.sp), // 设备图标 + SizedBox(width: 8.w), + Text( + 'deviceManagement'.tr, + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + ), + ], + ), + ); + } + // 电池信息网格布局 Widget _buildBatteryInfoGrid(bool isDarkMode) { return Obx(() { @@ -522,6 +552,8 @@ class HomeView extends GetView { batteryColor = Colors.red[600]!; } + bool isBatteryZero = batteryLevel == 0; + return Expanded( child: Padding( padding: EdgeInsets.symmetric(vertical: 6.h), @@ -540,32 +572,45 @@ class HomeView extends GetView { ), SizedBox(height: 4.h), - // 电池指示器 - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - batteryIcon, - size: 12.sp, - color: batteryColor, - ), - SizedBox(width: 2.w), - Text( - '$batteryLevel%', - style: TextStyle( - fontSize: 11.sp, - fontWeight: FontWeight.w500, - color: batteryColor, - ), - ), - if (isCharging) - Icon( - Icons.bolt, - size: 10.sp, - color: Colors.green[600], + // 电池指示器 - 当电量为0时,显示横线 + isBatteryZero + ? Container( + width: 20.w, // 横线宽度 + height: 12.sp, // 设置与图标相同的高度,确保对齐 + alignment: Alignment.center, // 居中对齐 + child: Container( + width: 10.w, + height: 1.5.h, // 实际横线高度 + color: isDarkMode + ? Colors.grey[600] + : Colors.grey[400], // 横线颜色 + ), + ) + : Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + batteryIcon, + size: 12.sp, + color: batteryColor, + ), + SizedBox(width: 2.w), + Text( + '$batteryLevel%', + style: TextStyle( + fontSize: 11.sp, + fontWeight: FontWeight.w500, + color: batteryColor, + ), + ), + if (isCharging) + Icon( + Icons.bolt, + size: 10.sp, + color: Colors.green[600], + ), + ], ), - ], - ), ], ), ), diff --git a/lib/modules/settings/controllers/settings_controller.dart b/lib/modules/settings/controllers/settings_controller.dart index 4553f3d1d..4dcecf302 100644 --- a/lib/modules/settings/controllers/settings_controller.dart +++ b/lib/modules/settings/controllers/settings_controller.dart @@ -247,11 +247,9 @@ class SettingsController extends GetxController { final PackageInfo packageInfo = await PackageInfo.fromPlatform(); appVersion.value = packageInfo.version; buildNumber.value = packageInfo.buildNumber; - print('版本信息: ${packageInfo.version}+${packageInfo.buildNumber}'); } catch (e) { appVersion.value = '未知'; buildNumber.value = '0'; - print('获取版本信息失败: $e'); } } diff --git a/lib/modules/translation/views/translation_view.dart b/lib/modules/translation/views/translation_view.dart index d69278376..a7c21d007 100644 --- a/lib/modules/translation/views/translation_view.dart +++ b/lib/modules/translation/views/translation_view.dart @@ -662,13 +662,15 @@ class TranslationView extends GetView { // 显示语言选择对话框 void _showLanguageSelectionDialog(bool isSource, bool isDarkMode) { - Get.dialog( - Dialog( - backgroundColor: isDarkMode ? Colors.grey[900] : Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(16.r), // 统一圆角尺寸为16 - ), - insetPadding: EdgeInsets.symmetric(horizontal: 20.w), + Get.dialog(Dialog( + backgroundColor: isDarkMode ? Colors.grey[900] : Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16.r), // 统一圆角尺寸为16 + ), + alignment: isSource ? Alignment.centerLeft : Alignment.centerRight, + insetPadding: EdgeInsets.symmetric(horizontal: 10.w), + child: SizedBox( + width: 0.4.sw, child: Padding( // 使用Padding替代Container的padding padding: EdgeInsets.all(12.w), // 统一内边距 @@ -807,7 +809,7 @@ class TranslationView extends GetView { ), ), ), - ); + )); } // 构建加载更多指示器 @@ -1035,7 +1037,7 @@ class TranslationView extends GetView { snackPosition: SnackPosition.BOTTOM, backgroundColor: Get.isDarkMode ? Colors.grey[800] : Colors.grey[200], colorText: Get.isDarkMode ? Colors.white : Colors.black, - duration: const Duration(seconds: 2), + duration: const Duration(milliseconds: 800), ); } catch (e) { // 显示删除失败提示 @@ -1045,7 +1047,7 @@ class TranslationView extends GetView { snackPosition: SnackPosition.BOTTOM, backgroundColor: Colors.red[400], colorText: Colors.white, - duration: const Duration(seconds: 3), + duration: const Duration(milliseconds: 1500), ); } } diff --git a/local_plugins/agent_service/lib/agent_service.dart b/local_plugins/agent_service/lib/agent_service.dart index f8294ef2a..5d39accce 100644 --- a/local_plugins/agent_service/lib/agent_service.dart +++ b/local_plugins/agent_service/lib/agent_service.dart @@ -410,6 +410,7 @@ class AgentService { /// /// [imagePath] 图片文件路径 /// [text] 可选的文本描述或问题 + /// [imageUrl] 图片url /// [speakResponse] 是否朗读响应 /// 返回是否成功处理图片 static Future processImageInput(String imagePath, String imageUrl,