From ed99e75ccee68afa63b7480be2a89da08bc92128 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Fri, 1 Aug 2025 20:26:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=85=8D=E5=AF=B9):=20=E6=B7=BB=E5=8A=A0i?= =?UTF-8?q?OS=E8=93=9D=E7=89=99=E5=BC=95=E5=AF=BC=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86=E5=B9=B6=E6=94=AF=E6=8C=81=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加蓝牙引导对话框的国际化文本 使用flutter_screenutil进行响应式布局 移除未使用的导入 --- lib/core/translations/language/en_us.dart | 13 +++++ lib/core/translations/language/zh_cn.dart | 9 +++ .../controllers/pairing_controller.dart | 56 +++++++++++-------- 3 files changed, 55 insertions(+), 23 deletions(-) diff --git a/lib/core/translations/language/en_us.dart b/lib/core/translations/language/en_us.dart index f529e2a7a..51d9bd764 100644 --- a/lib/core/translations/language/en_us.dart +++ b/lib/core/translations/language/en_us.dart @@ -813,6 +813,19 @@ const Map enUS = { 'deviceAuthorizationFailedCheckCode': 'Device authorization failed, please check authorization code', + ///iOS蓝牙引导窗 + 'bluetoothGuideTitle': 'Manual Bluetooth Activation Required', // 需要手动开启蓝牙 + 'bluetoothGuideSteps': 'Please follow these steps:', // 请按照以下步骤操作: + 'bluetoothGuideStep1': + 'Enable Bluetooth: Settings → Bluetooth → Turn On', // 开启蓝牙:设置 → 蓝牙 → 开启 + 'bluetoothGuideStep2': + 'Connect Device: Find your device in "My Devices" and tap to connect', // 连接设备:在"我的设备"中找到您的设备并点击连接 + 'bluetoothGuideStep3': + 'Return to app to continue pairing process', // 返回应用继续配对流程 + 'bluetoothGuideTip': + 'Tip: You can also long press the Bluetooth icon in Control Center to quickly access Bluetooth settings', // 提示:也可以从控制中心长按蓝牙图标快速进入蓝牙设置 + 'iKnow': 'I Know', // 我知道了 + // 用户反馈页 "feedback": "Feedback", 'feedbackInfo': 'Provide feedback or suggestions', diff --git a/lib/core/translations/language/zh_cn.dart b/lib/core/translations/language/zh_cn.dart index 52a3cc093..6bd1701d6 100644 --- a/lib/core/translations/language/zh_cn.dart +++ b/lib/core/translations/language/zh_cn.dart @@ -746,6 +746,15 @@ const Map zhCN = { 'bleConnectionFailed': 'BLE连接失败', 'deviceAuthorizationFailedCheckCode': '设备授权失败,请检查授权码', + ///iOS蓝牙引导窗 + 'bluetoothGuideTitle': '需要手动开启蓝牙', // 需要手动开启蓝牙 + 'bluetoothGuideSteps': '请按照以下步骤操作:', // 请按照以下步骤操作: + 'bluetoothGuideStep1': '开启蓝牙:设置 → 蓝牙 → 开启', // 开启蓝牙:设置 → 蓝牙 → 开启 + 'bluetoothGuideStep2': '连接设备:在"我的设备"中找到您的设备并点击连接', // 连接设备:在"我的设备"中找到您的设备并点击连接 + 'bluetoothGuideStep3': '返回应用继续配对流程', // 返回应用继续配对流程 + 'bluetoothGuideTip': '提示:也可以从控制中心长按蓝牙图标快速进入蓝牙设置', // 提示:也可以从控制中心长按蓝牙图标快速进入蓝牙设置 + 'iKnow': '我知道了', // 我知道了 + //用户反馈页 "feedback": "用户反馈", 'feedbackInfo': '提供反馈或建议', diff --git a/lib/modules/pairing/controllers/pairing_controller.dart b/lib/modules/pairing/controllers/pairing_controller.dart index dedb8fbbb..c467e2776 100644 --- a/lib/modules/pairing/controllers/pairing_controller.dart +++ b/lib/modules/pairing/controllers/pairing_controller.dart @@ -1,12 +1,10 @@ -import 'dart:convert'; -import 'dart:typed_data'; - import 'package:app_settings/app_settings.dart'; import 'package:voitrans/data/models/appconfig_model.dart'; import '/data/models/appconfig.dart'; import '/data/models/user_Info.dart'; import '/data/services/network/api.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'dart:async'; import 'package:permission_handler/permission_handler.dart'; @@ -16,7 +14,6 @@ import 'dart:io'; import '../../../data/services/bluetooth_manager.dart'; import '../../../data/services/ble_manager.dart'; import '../../../core/utils/permission_util.dart'; -import 'package:url_launcher/url_launcher.dart'; /// 配对状态枚举 - 简化版本 enum PairingState { @@ -1028,52 +1025,65 @@ class PairingController extends GetxController { void _showBluetoothGuideDialog() { Get.dialog( AlertDialog( - title: Text('需要手动开启蓝牙'), + title: Text('bluetoothGuideTitle'.tr), content: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('请按照以下步骤操作:'), - SizedBox(height: 16), + Text('bluetoothGuideSteps'.tr), + SizedBox(height: 16.h), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('1. ', style: TextStyle(fontWeight: FontWeight.bold)), - Expanded(child: Text('开启蓝牙:设置 → 蓝牙 → 开启')), + Text('1. ', + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 14.sp)), + Expanded( + child: Text('bluetoothGuideStep1'.tr, + style: TextStyle(fontSize: 14.sp))), ], ), - SizedBox(height: 8), + SizedBox(height: 8.h), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('2. ', style: TextStyle(fontWeight: FontWeight.bold)), - Expanded(child: Text('连接设备:在"我的设备"中找到您的设备并点击连接')), + Text('2. ', + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 14.sp)), + Expanded( + child: Text('bluetoothGuideStep2'.tr, + style: TextStyle(fontSize: 14.sp))), ], ), - SizedBox(height: 8), + SizedBox(height: 8.h), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('3. ', style: TextStyle(fontWeight: FontWeight.bold)), - Expanded(child: Text('返回应用继续配对流程')), + Text('3. ', + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 14.sp)), + Expanded( + child: Text('bluetoothGuideStep3'.tr, + style: TextStyle(fontSize: 14.sp))), ], ), - SizedBox(height: 16), + SizedBox(height: 16.h), Container( - padding: EdgeInsets.all(12), + padding: EdgeInsets.all(12.w), decoration: BoxDecoration( color: Colors.blue.withOpacity(0.1), - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular(8.r), border: Border.all(color: Colors.blue.withOpacity(0.3)), ), child: Row( children: [ - Icon(Icons.info_outline, color: Colors.blue, size: 20), - SizedBox(width: 8), + Icon(Icons.info_outline, color: Colors.blue, size: 20.sp), + SizedBox(width: 8.w), Expanded( child: Text( - '提示:也可以从控制中心长按蓝牙图标快速进入蓝牙设置', - style: TextStyle(fontSize: 12, color: Colors.blue[700]), + 'bluetoothGuideTip'.tr, + style: + TextStyle(fontSize: 12.sp, color: Colors.blue[700]), ), ), ], @@ -1084,7 +1094,7 @@ class PairingController extends GetxController { actions: [ TextButton( onPressed: () => Get.back(), - child: Text('我知道了'), + child: Text('iKnow'.tr, style: TextStyle(fontSize: 14.sp)), ), ], ),