多语言
This commit is contained in:
@@ -47,7 +47,7 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
Widget build(BuildContext context) {
|
||||
Map device = {
|
||||
"name": widget.bleDevice.name,
|
||||
"mac": widget.bleDevice.mac,
|
||||
"mac".tr: widget.bleDevice.mac,
|
||||
"rssi": widget.bleDevice.scanResult.rssi,
|
||||
"bind": widget.bleDevice.bind,
|
||||
};
|
||||
@@ -74,7 +74,7 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
),
|
||||
Obx(() {
|
||||
if (blueteethBindController.currentDeviceMac.value ==
|
||||
device['mac']) {
|
||||
device['mac'.tr]) {
|
||||
return SizedBox(
|
||||
width: 24.rpx,
|
||||
height: 24.rpx,
|
||||
@@ -185,7 +185,7 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
blueteethBindController
|
||||
.currentDeviceMac!.value.isNotEmpty) {
|
||||
if (blueteethBindController.currentDeviceMac?.value !=
|
||||
device['mac']) {
|
||||
device['mac'.tr]) {
|
||||
showConfirmDialog(
|
||||
context, Container(), "其他设备正在绑定中,是否终止其他设备绑定?".tr,
|
||||
onConfirm: () {
|
||||
@@ -198,7 +198,7 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
}
|
||||
|
||||
blueteethBindController.currentDeviceMac?.value =
|
||||
device['mac']!;
|
||||
device['mac'.tr]!;
|
||||
blueteethBindController.updateAll();
|
||||
|
||||
if (device['bind'] == true) {
|
||||
@@ -294,7 +294,7 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
blueteethBindController.resumeScanning();
|
||||
},
|
||||
onCancel: () {
|
||||
print('用户点击了取消');
|
||||
print('用户点击了取消'.tr);
|
||||
blueteethBindController.currentDeviceMac.value = "";
|
||||
blueteethBindController.resumeScanning();
|
||||
blueteethBindController.updateAll();
|
||||
@@ -347,14 +347,14 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
Map<String, dynamic> data = {
|
||||
"type": type,
|
||||
"mac": mac,
|
||||
"mac".tr: mac,
|
||||
"wifi": false,
|
||||
"celibration": false,
|
||||
"person_info": false,
|
||||
"time": DateTime.now().millisecondsSinceEpoch,
|
||||
};
|
||||
requestWithLog(
|
||||
logTitle: "更新用户绑定流程",
|
||||
logTitle: "更新用户绑定流程".tr,
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
@@ -505,14 +505,14 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
await bledevice.connect();
|
||||
var res2 = bledevice.isConnected;
|
||||
if (!res2) {
|
||||
edm.EasyDartModule.logger.error("蓝牙连接失败");
|
||||
DailyLogUtils.printLog("蓝牙连接失败");
|
||||
edm.EasyDartModule.logger.error("蓝牙连接失败".tr);
|
||||
DailyLogUtils.printLog("蓝牙连接失败".tr);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "蓝牙连接失败".tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
throw Exception("蓝牙连接失败");
|
||||
throw Exception("蓝牙连接失败".tr);
|
||||
}
|
||||
blueteethBindController.blueConnectFlag.value = 2;
|
||||
blueteethBindController.currentDevice = bledevice;
|
||||
@@ -525,11 +525,11 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
//智能床
|
||||
macAddress = await getMacFromType2(bledevice, timeout);
|
||||
} else {
|
||||
throw Exception("不支持的设备类型");
|
||||
throw Exception("不支持的设备类型".tr);
|
||||
}
|
||||
|
||||
if (macAddress == null) {
|
||||
throw Exception("未能获取到MAC地址");
|
||||
throw Exception("未能获取到MAC地址".tr);
|
||||
}
|
||||
|
||||
// device.macA = macAddress;
|
||||
@@ -565,7 +565,7 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
}
|
||||
|
||||
await requestWithLog(
|
||||
logTitle: "获取设备状态",
|
||||
logTitle: "获取设备状态".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
@@ -578,11 +578,11 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
// 查找当前MAC对应的数据
|
||||
String macKey = mac.replaceAll(':', '').toUpperCase();
|
||||
for (var item in responseList) {
|
||||
if (item['mac'].toString().toUpperCase() == macKey) {
|
||||
if (item['mac'.tr].toString().toUpperCase() == macKey) {
|
||||
// 更新 bleDevice 的状态
|
||||
//如果传感器已经绑定 暂时不处理
|
||||
// bleDevice.bind = item['bind'] ?? bleDevice.bind;
|
||||
bleDevice.macA = item['mac'];
|
||||
bleDevice.macA = item['mac'.tr];
|
||||
if (item['bindMac'] != null &&
|
||||
item['bindMac'].toString().isNotEmpty) {
|
||||
bleDevice.macB = item['bindMac'];
|
||||
@@ -634,10 +634,10 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
try {
|
||||
final mac = await completer.future.timeout(timeout);
|
||||
if (mac == null || mac.isEmpty) {
|
||||
throw Exception("获取MAC失败");
|
||||
throw Exception("获取MAC失败".tr);
|
||||
}
|
||||
if (mac == "000000000000") {
|
||||
throw Exception("获取MAC失败");
|
||||
throw Exception("获取MAC失败".tr);
|
||||
}
|
||||
await subscription.cancel();
|
||||
return mac;
|
||||
@@ -646,7 +646,7 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
if (attempt == maxRetries - 1) rethrow;
|
||||
}
|
||||
}
|
||||
throw Exception("获取MAC超时");
|
||||
throw Exception("获取MAC超时".tr);
|
||||
}
|
||||
|
||||
Future<String> getMacFromType2(THapp bledevice, Duration timeout) async {
|
||||
@@ -685,7 +685,7 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
ef.log("[获取设备 MAC]:失败:$e");
|
||||
}
|
||||
|
||||
throw Exception("获取MAC超时");
|
||||
throw Exception("获取MAC超时".tr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,18 +705,18 @@ String parseMacFromBleResponse(List<int> data) {
|
||||
.join('');
|
||||
return macAddress;
|
||||
} else {
|
||||
throw Exception("BLE返回数据格式不正确");
|
||||
throw Exception("BLE返回数据格式不正确".tr);
|
||||
}
|
||||
}
|
||||
|
||||
String parseMacFromTH2Response(List<int> data) {
|
||||
if (data.length < 17) {
|
||||
throw Exception("数据长度不足,无法解析MAC");
|
||||
throw Exception("数据长度不足,无法解析MAC".tr);
|
||||
}
|
||||
|
||||
int status = data[8];
|
||||
if (status != 0x03 && status != 0x04) {
|
||||
throw Exception("未连接心率带");
|
||||
throw Exception("未连接心率带".tr);
|
||||
}
|
||||
|
||||
// 提取9~14字节的MAC地址
|
||||
|
||||
@@ -77,7 +77,7 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
|
||||
if (res.code == HttpStatusCodes.ok) {
|
||||
updateAll();
|
||||
} else {
|
||||
safeShowNotification(res.msg ?? "获取设备状态异常");
|
||||
safeShowNotification(res.msg ?? "获取设备状态异常".tr);
|
||||
EasyDartModule.logger.info("获取设备状态异常: $res");
|
||||
DailyLogUtils.writeLog("获取设备状态异常: $res");
|
||||
}
|
||||
@@ -89,13 +89,13 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
|
||||
if (res.code == HttpStatusCodes.ok) {
|
||||
updateAll();
|
||||
} else {
|
||||
safeShowNotification(res.msg ?? "获取设备状态异常");
|
||||
safeShowNotification(res.msg ?? "获取设备状态异常".tr);
|
||||
EasyDartModule.logger.info("获取设备状态异常: $res");
|
||||
DailyLogUtils.writeLog("获取设备状态异常: $res");
|
||||
}
|
||||
}).catchError((e, stack) {
|
||||
print("updateDeviceStatus 执行异常: $e\n$stack");
|
||||
safeShowNotification("设备状态请求失败");
|
||||
safeShowNotification("设备状态请求失败".tr);
|
||||
EasyDartModule.logger.info("设备状态异常: $e");
|
||||
DailyLogUtils.writeLog("设备状态异常: $e");
|
||||
});
|
||||
@@ -165,7 +165,7 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
|
||||
// 新建一个 Map,便于快速通过 mac 查找返回的设备状态
|
||||
final Map<String, dynamic> responseMap = {
|
||||
for (var item in responseList)
|
||||
item['mac'].toString().toUpperCase(): item
|
||||
item['mac'.tr].toString().toUpperCase(): item
|
||||
};
|
||||
|
||||
// 遍历 blueRawData,更新 bind 状态
|
||||
@@ -214,7 +214,7 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
|
||||
String queryUrl = "$serviceAddress$serviceName$serviceApi";
|
||||
var data = {
|
||||
"deviceType": model.deviceType,
|
||||
"mac": bleDevice.mac,
|
||||
"mac".tr: bleDevice.mac,
|
||||
"macA": bleDevice.macA,
|
||||
if (bleDevice.macB != null && bleDevice.macB!.isNotEmpty)
|
||||
"macB": bleDevice.macB,
|
||||
@@ -266,12 +266,12 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
var data = {
|
||||
"type": type,
|
||||
"mac": sleepData['mac'],
|
||||
"mac".tr: sleepData['mac'.tr],
|
||||
"time": DateTime.now().millisecondsSinceEpoch,
|
||||
"data": sleepData,
|
||||
};
|
||||
await requestWithLog(
|
||||
logTitle: "更新睡眠习惯",
|
||||
logTitle: "更新睡眠习惯".tr,
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
@@ -290,7 +290,7 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
|
||||
Map<String, dynamic> result = {};
|
||||
|
||||
await requestWithLog(
|
||||
logTitle: "更新睡眠习惯",
|
||||
logTitle: "更新睡眠习惯".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
@@ -319,7 +319,7 @@ void safeShowNotification(String msg) {
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
} else {
|
||||
print("TopSlideNotification 未显示:context 不可用或未挂载");
|
||||
print("TopSlideNotification 未显示:context 不可用或未挂载".tr);
|
||||
}
|
||||
} catch (e, stack) {
|
||||
// print("TopSlideNotification 显示异常: $e\n$stack");
|
||||
|
||||
@@ -101,9 +101,9 @@ class DeviceInfoWidget extends GetView {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildInfoRow(
|
||||
'设备ID',
|
||||
'设备ID'.tr,
|
||||
deviceListController
|
||||
.model.deviceList[index]["mac"] ??
|
||||
.model.deviceList[index]["mac".tr] ??
|
||||
'',
|
||||
valueColor: (deviceListController
|
||||
.model.deviceList[index]
|
||||
@@ -112,10 +112,10 @@ class DeviceInfoWidget extends GetView {
|
||||
? Color(0xFF929699)
|
||||
: null),
|
||||
_buildInfoRow(
|
||||
'房间',
|
||||
'房间'.tr,
|
||||
deviceListController.model
|
||||
.deviceList[index]["roomName"] ??
|
||||
'未分配房间',
|
||||
'未分配房间'.tr,
|
||||
valueColor: (deviceListController
|
||||
.model.deviceList[index]
|
||||
["status"]?["status"]) ==
|
||||
@@ -123,13 +123,13 @@ class DeviceInfoWidget extends GetView {
|
||||
? Color(0xFF929699)
|
||||
: null),
|
||||
_buildInfoRow(
|
||||
'设备状态',
|
||||
'设备状态'.tr,
|
||||
(deviceListController
|
||||
.model.deviceList[index]
|
||||
["status"]?["status"]) ==
|
||||
1
|
||||
? '已绑定'
|
||||
: '已绑定',
|
||||
? '已绑定'.tr
|
||||
: '已绑定'.tr,
|
||||
valueColor: (deviceListController
|
||||
.model.deviceList[index]
|
||||
["status"]?["status"]) ==
|
||||
@@ -165,7 +165,7 @@ class DeviceInfoWidget extends GetView {
|
||||
DailyLogUtils.writeError("发生异常: $e");
|
||||
}
|
||||
},
|
||||
text: '控制',
|
||||
text: '控制'.tr,
|
||||
options: FFButtonOptions(
|
||||
color: Color(0XFF85F5FF),
|
||||
textStyle: TextStyle(
|
||||
@@ -245,7 +245,7 @@ class DeviceInfoWidget extends GetView {
|
||||
children: [
|
||||
if (device['bind_type'] == 1)
|
||||
Text(
|
||||
'已分享:',
|
||||
'已分享:'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 21.rpx,
|
||||
@@ -274,7 +274,7 @@ class DeviceInfoWidget extends GetView {
|
||||
),
|
||||
if (device['bind_type'] == 1)
|
||||
Text(
|
||||
'人',
|
||||
'人'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 21.rpx,
|
||||
@@ -284,7 +284,7 @@ class DeviceInfoWidget extends GetView {
|
||||
),
|
||||
if (device['bind_type'] == 2)
|
||||
Text(
|
||||
'来自',
|
||||
'来自'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 21.rpx,
|
||||
@@ -309,7 +309,7 @@ class DeviceInfoWidget extends GetView {
|
||||
),
|
||||
if (device['bind_type'] == 2)
|
||||
Text(
|
||||
'的分享',
|
||||
'的分享'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 21.rpx,
|
||||
@@ -359,7 +359,7 @@ class DeviceInfoWidget extends GetView {
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Text(
|
||||
'睡眠报告',
|
||||
'睡眠报告'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
|
||||
@@ -67,7 +67,7 @@ class _MHTBindDeviceSuccessState extends State<MHTBindDeviceSuccess> {
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'绑定成功.标题'.tr,
|
||||
'标题'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
@@ -187,7 +187,7 @@ class _MHTBindDeviceSuccessState extends State<MHTBindDeviceSuccess> {
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Text(
|
||||
'绑定成功.绑定成功'.tr,
|
||||
'绑定成功'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 48.rpx,
|
||||
@@ -206,7 +206,7 @@ class _MHTBindDeviceSuccessState extends State<MHTBindDeviceSuccess> {
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Text(
|
||||
'绑定成功.分享标题'.tr,
|
||||
'分享标题'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
@@ -225,7 +225,7 @@ class _MHTBindDeviceSuccessState extends State<MHTBindDeviceSuccess> {
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
'绑定成功.分享内容'.tr,
|
||||
'分享内容'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
@@ -245,40 +245,9 @@ class _MHTBindDeviceSuccessState extends State<MHTBindDeviceSuccess> {
|
||||
Map editeData;
|
||||
BlueToothDataModel data =
|
||||
blueteethBindController.shareDevice;
|
||||
editeData = {"mac": data.mac};
|
||||
editeData = {"mac".tr: data.mac};
|
||||
Get.toNamed("/deviceSharePage", arguments: editeData);
|
||||
// // TopSlideNotification.show(
|
||||
// // context,
|
||||
// // text: "功能开发中...",
|
||||
// // );
|
||||
// // return;
|
||||
// PersonController personController = Get.find();
|
||||
// String deviceID =
|
||||
// personController.currentPersonId.value;
|
||||
|
||||
// BodyDeviceController bodyDeviceController =
|
||||
// Get.find();
|
||||
// await bodyDeviceController.getDeviceList();
|
||||
// List deviceList =
|
||||
// bodyDeviceController.deviceList.value;
|
||||
|
||||
// if (deviceList != null && deviceList.isNotEmpty) {
|
||||
// // 查找第一个 _id 匹配的设备
|
||||
// final matchedDevice = deviceList.firstWhere(
|
||||
// (element) => element['_id'] == deviceID,
|
||||
// orElse: () => null,
|
||||
// );
|
||||
|
||||
// if (matchedDevice != null) {
|
||||
// // 跳转并传入设备
|
||||
// Get.toNamed("/deviceSharePage",
|
||||
// arguments: matchedDevice);
|
||||
// } else {
|
||||
// print("未找到匹配的设备");
|
||||
// }
|
||||
// } else {
|
||||
// print("设备列表为空");
|
||||
// }
|
||||
|
||||
},
|
||||
colors: AppConstants().mhtButtongradientColors,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
@@ -300,7 +269,7 @@ class _MHTBindDeviceSuccessState extends State<MHTBindDeviceSuccess> {
|
||||
color: stringToColor("#003058"),
|
||||
),
|
||||
Text(
|
||||
'绑定成功.立即分享'.tr,
|
||||
'立即分享'.tr,
|
||||
style: TextStyle(
|
||||
color: stringToColor("#003058"),
|
||||
fontFamily: 'Inter',
|
||||
@@ -385,7 +354,7 @@ class _MHTBindDeviceSuccessState extends State<MHTBindDeviceSuccess> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'绑定成功.返回'.tr,
|
||||
'返回'.tr,
|
||||
style: TextStyle(
|
||||
color: stringToColor("#003058"),
|
||||
fontFamily: 'Inter',
|
||||
|
||||
@@ -110,7 +110,7 @@ class _MHTBindDeviceTypePageState extends State<MHTBindDeviceTypePage> {
|
||||
// 使用 Obx 来监听 deviceTypeList 的变化
|
||||
SizedBox(height: 26.rpx), // 开始的间隔
|
||||
Text(
|
||||
"选择类型",
|
||||
"选择类型".tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 30.rpx),
|
||||
),
|
||||
SizedBox(height: 32.rpx), // 开始的间隔
|
||||
|
||||
@@ -626,7 +626,7 @@ class _MHTBlueteethDevicePageState extends State<MHTBlueteethDevicePage> {
|
||||
padding: EdgeInsets.all(0),
|
||||
keyword: mhtBlueToothController.search.value,
|
||||
color: Colors.red,
|
||||
hint: "检索设备",
|
||||
hint: "检索设备".tr,
|
||||
onChange: (d) {
|
||||
mhtBlueToothController.search.value = d;
|
||||
},
|
||||
|
||||
@@ -648,7 +648,7 @@ class _MHTCalibrationPageCopyState extends State<MHTCalibrationPageCopy> {
|
||||
|
||||
// 发起校准请求
|
||||
requestWithLog(
|
||||
logTitle: "设备校准",
|
||||
logTitle: "设备校准".tr,
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
@@ -711,7 +711,7 @@ class _MHTCalibrationPageCopyState extends State<MHTCalibrationPageCopy> {
|
||||
|
||||
// 发起校准请求
|
||||
requestWithLog(
|
||||
logTitle: "设备校准",
|
||||
logTitle: "设备校准".tr,
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
@@ -863,7 +863,7 @@ class _MHTCalibrationPageCopyState extends State<MHTCalibrationPageCopy> {
|
||||
String progressUrl = "$serviceAddress$progressApi?id=$cid";
|
||||
|
||||
requestWithLog(
|
||||
logTitle: "设备校准进度",
|
||||
logTitle: "设备校准进度".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: progressUrl,
|
||||
onSuccess: (res) {
|
||||
@@ -1022,21 +1022,21 @@ class _MHTCalibrationPageCopyState extends State<MHTCalibrationPageCopy> {
|
||||
String queryUrl =
|
||||
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
|
||||
requestWithLog(
|
||||
logTitle: "查询绑定流程",
|
||||
logTitle: "查询绑定流程".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
print(res);
|
||||
Map<String, dynamic> data = {
|
||||
"type": type,
|
||||
"mac": mac,
|
||||
"mac".tr: mac,
|
||||
"wifi": res.data['wifi'],
|
||||
"celibration": true,
|
||||
"person_info": false,
|
||||
"time": DateTime.now().millisecondsSinceEpoch,
|
||||
};
|
||||
requestWithLog(
|
||||
logTitle: "更新绑定流程",
|
||||
logTitle: "更新绑定流程".tr,
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
|
||||
@@ -746,7 +746,7 @@ class _MHTCalibrationPageState extends State<MHTCalibrationPage> {
|
||||
String progressUrl = "$serviceAddress$progressApi?id=$cid";
|
||||
|
||||
requestWithLog(
|
||||
logTitle: "设备校准进度",
|
||||
logTitle: "设备校准进度".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: progressUrl,
|
||||
onSuccess: (res) {
|
||||
@@ -908,7 +908,7 @@ class _MHTCalibrationPageState extends State<MHTCalibrationPage> {
|
||||
}
|
||||
// data['cancel'] = true;
|
||||
requestWithLog(
|
||||
logTitle: "设备校准",
|
||||
logTitle: "设备校准".tr,
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
@@ -982,20 +982,20 @@ class _MHTCalibrationPageState extends State<MHTCalibrationPage> {
|
||||
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
|
||||
|
||||
requestWithLog(
|
||||
logTitle: "查询绑定流程",
|
||||
logTitle: "查询绑定流程".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
Map<String, dynamic> data = {
|
||||
"type": type,
|
||||
"mac": mac,
|
||||
"mac".tr: mac,
|
||||
"wifi": res.data['wifi'],
|
||||
"celibration": true,
|
||||
"person_info": false,
|
||||
"time": DateTime.now().millisecondsSinceEpoch,
|
||||
};
|
||||
requestWithLog(
|
||||
logTitle: "更新绑定流程",
|
||||
logTitle: "更新绑定流程".tr,
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
|
||||
@@ -753,7 +753,7 @@ class _MHTCalibrationAfterPageState extends State<MHTCalibrationAfterPage> {
|
||||
String progressUrl = "$serviceAddress$progressApi?id=$cid";
|
||||
|
||||
requestWithLog(
|
||||
logTitle: "设备校准进度",
|
||||
logTitle: "设备校准进度".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: progressUrl,
|
||||
onSuccess: (res) {
|
||||
@@ -915,7 +915,7 @@ class _MHTCalibrationAfterPageState extends State<MHTCalibrationAfterPage> {
|
||||
}
|
||||
// data['cancel'] = true;
|
||||
requestWithLog(
|
||||
logTitle: "设备校准",
|
||||
logTitle: "设备校准".tr,
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
@@ -989,20 +989,20 @@ class _MHTCalibrationAfterPageState extends State<MHTCalibrationAfterPage> {
|
||||
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
|
||||
|
||||
requestWithLog(
|
||||
logTitle: "查询绑定流程",
|
||||
logTitle: "查询绑定流程".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
Map<String, dynamic> data = {
|
||||
"type": type,
|
||||
"mac": mac,
|
||||
"mac".tr: mac,
|
||||
"wifi": res.data['wifi'],
|
||||
"celibration": true,
|
||||
"person_info": false,
|
||||
"time": DateTime.now().millisecondsSinceEpoch,
|
||||
};
|
||||
requestWithLog(
|
||||
logTitle: "更新绑定流程",
|
||||
logTitle: "更新绑定流程".tr,
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
|
||||
@@ -38,7 +38,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
//todo 初始化传感器id
|
||||
// Initialize person A
|
||||
peopleList.add({
|
||||
'mac': device?.macA,
|
||||
'mac'.tr: device?.macA,
|
||||
'gender': 1,
|
||||
'id': device!.macAID,
|
||||
});
|
||||
@@ -46,7 +46,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
// Initialize person B if exists
|
||||
if (device?.macB != null && device!.macB!.isNotEmpty) {
|
||||
peopleList.add({
|
||||
'mac': device.macB,
|
||||
'mac'.tr: device.macB,
|
||||
'gender': 1,
|
||||
'id': device!.macBID,
|
||||
});
|
||||
@@ -105,7 +105,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
|
||||
try {
|
||||
var body = {
|
||||
'mac': personData['mac'],
|
||||
'mac'.tr: personData['mac'.tr],
|
||||
'name': personData['name'],
|
||||
'gender': personData['gender'],
|
||||
'height': personData['height'],
|
||||
@@ -117,7 +117,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
'id': personData['id'],
|
||||
};
|
||||
await requestWithLog(
|
||||
logTitle: "保存用户信息",
|
||||
logTitle: "保存用户信息".tr,
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: body,
|
||||
@@ -171,7 +171,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'人员资料',
|
||||
'人员资料'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -192,7 +192,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
for (var person in peopleList) {
|
||||
await _savePersonData(person, context);
|
||||
}
|
||||
TopSlideNotification.show(context, text: "保存成功");
|
||||
TopSlideNotification.show(context, text: "保存成功".tr);
|
||||
MHTHomeController mhtHomeController = Get.find();
|
||||
mhtHomeController.getPersonList();
|
||||
// Get.offNamed("/bindDeviceSuccess");
|
||||
@@ -214,7 +214,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"下一步",
|
||||
"下一步".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0XFF011D33),
|
||||
@@ -251,7 +251,9 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
top: index == 0 ? 30.rpx : 90.rpx,
|
||||
bottom: 20.rpx),
|
||||
child: Text(
|
||||
"人员资料${index == 0 ? "A" : "B"}",
|
||||
index == 0
|
||||
? 'person_info_A'.tr
|
||||
: 'person_info_B'.tr,
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 30.rpx),
|
||||
),
|
||||
@@ -272,7 +274,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'姓名',
|
||||
'姓名'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
@@ -289,10 +291,10 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: Colors.white),
|
||||
decoration: const InputDecoration(
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.transparent,
|
||||
filled: true,
|
||||
hintText: "请输入姓名",
|
||||
hintText: "请输入姓名".tr,
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.white),
|
||||
border: InputBorder.none,
|
||||
@@ -323,12 +325,11 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
const Duration(milliseconds: 250),
|
||||
() {
|
||||
showOneSelectionDialog(context,
|
||||
arr: ["女", "男"],
|
||||
title: "选择性别".tr,
|
||||
arr: ["女".tr, "男".tr],
|
||||
checkIndex: peopleList[index]
|
||||
['gender'] ==
|
||||
"女"
|
||||
? 0
|
||||
: 1, checkChange: (sindex) {
|
||||
['gender'],
|
||||
checkChange: (sindex) {
|
||||
setState(() {
|
||||
peopleList[index]['gender'] =
|
||||
sindex;
|
||||
@@ -342,7 +343,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'性别',
|
||||
'性别'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
@@ -356,7 +357,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
Container(
|
||||
width: 200.rpx,
|
||||
child: Text(
|
||||
'${peopleList[index]['gender'] == 1 ? '男' : '女'}',
|
||||
'${peopleList[index]['gender'] == 1 ? '男'.tr : '女'.tr}',
|
||||
textAlign: TextAlign.right,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
@@ -413,7 +414,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'身高(cm)',
|
||||
'身高(cm)'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
@@ -476,7 +477,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'体重(kg)',
|
||||
'体重(kg)'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
@@ -543,7 +544,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'生日',
|
||||
'生日'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
@@ -563,7 +564,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
? time_08_Formatter_pattern(
|
||||
peopleList[index]
|
||||
['birthday'],
|
||||
"yyyy年MM月dd日")
|
||||
"yyyy年MM月dd日".tr)
|
||||
: '',
|
||||
textAlign: TextAlign.right,
|
||||
style: TextStyle(
|
||||
@@ -622,7 +623,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.transparent,
|
||||
filled: true,
|
||||
hintText: "请输入联系方式",
|
||||
hintText: "请输入联系方式".tr,
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.white),
|
||||
border: InputBorder.none,
|
||||
|
||||
@@ -587,7 +587,7 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text: "wifi页.配网成功".tr,
|
||||
text: "配网成功".tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
@@ -597,7 +597,7 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text: "wifi页.配网失败".tr,
|
||||
text: "配网失败".tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
@@ -607,7 +607,7 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
||||
} else {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "wifi页.配网失败".tr,
|
||||
text: "配网失败".tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
@@ -1078,21 +1078,21 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
||||
String queryUrl =
|
||||
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
|
||||
requestWithLog(
|
||||
logTitle: "查询绑定流程",
|
||||
logTitle: "查询绑定流程".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
print(res);
|
||||
Map<String, dynamic> data = {
|
||||
"type": type,
|
||||
"mac": mac,
|
||||
"mac".tr: mac,
|
||||
"wifi": true,
|
||||
"celibration": res.data['celibration'],
|
||||
"person_info": res.data['person_info'],
|
||||
"time": DateTime.now().millisecondsSinceEpoch,
|
||||
};
|
||||
requestWithLog(
|
||||
logTitle: "更新绑定流程",
|
||||
logTitle: "更新绑定流程".tr,
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
@@ -1108,7 +1108,7 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
||||
try {
|
||||
THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device);
|
||||
await bledevice.disconnect();
|
||||
DailyLogUtils.writeLog("关闭蓝牙连接成功");
|
||||
DailyLogUtils.writeLog("关闭蓝牙连接成功".tr);
|
||||
} catch (e) {
|
||||
DailyLogUtils.writeError("关闭蓝牙连接失败: $e");
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text: "wifi页.配网成功".tr,
|
||||
text: "配网成功".tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
@@ -570,7 +570,7 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text: "wifi页.配网失败".tr,
|
||||
text: "配网失败".tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
@@ -580,7 +580,7 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
||||
} else {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "wifi页.配网失败".tr,
|
||||
text: "配网失败".tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
@@ -1051,21 +1051,21 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
||||
String queryUrl =
|
||||
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
|
||||
requestWithLog(
|
||||
logTitle: "查询绑定流程",
|
||||
logTitle: "查询绑定流程".tr,
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
print(res);
|
||||
Map<String, dynamic> data = {
|
||||
"type": type,
|
||||
"mac": mac,
|
||||
"mac".tr: mac,
|
||||
"wifi": true,
|
||||
"celibration": res.data['celibration'],
|
||||
"person_info": res.data['person_info'],
|
||||
"time": DateTime.now().millisecondsSinceEpoch,
|
||||
};
|
||||
requestWithLog(
|
||||
logTitle: "更新绑定流程",
|
||||
logTitle: "更新绑定流程".tr,
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
@@ -1081,7 +1081,7 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
||||
try {
|
||||
THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device);
|
||||
await bledevice.disconnect();
|
||||
DailyLogUtils.writeLog("关闭蓝牙连接成功");
|
||||
DailyLogUtils.writeLog("关闭蓝牙连接成功".tr);
|
||||
} catch (e) {
|
||||
DailyLogUtils.writeError("关闭蓝牙连接失败: $e");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user