更新设备校准

This commit is contained in:
wyf
2025-06-03 09:00:01 +08:00
parent 7a816922fa
commit eed93bc6a4
30 changed files with 4257 additions and 1259 deletions

View File

@@ -299,7 +299,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
BlueteethBindController blueteethBindController = Get.find();
blueteethBindController.currentDeviceMac?.value =
widget.device['mac'];
await Get.toNamed("/calibrationPage", arguments: 2);
await Get.toNamed("/calibrationPersonPage", arguments: 2);
},
),
_buildMenuItem(
@@ -1290,147 +1290,9 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
Future<void> dealWifi(device) async {
bodyDeviceController.wifiMac = device['mac'];
Get.toNamed("/wifiPage", arguments: device);
Get.toNamed("/wifiPagePerson", arguments: device);
return;
// final blueteethBindController = Get.find<BlueteethBindController>();
// final themeController = Get.find<ThemeController>();
// // 显示加载对话框
// showLoadingDialog(Get.context!, title: "连接中...".tr);
// // 设置超时定时器
// Timer? timeoutTimer;
// bool isConnected = false;
// try {
// // 开始扫描蓝牙设备
// await FlutterBluePlus.startScan(timeout: Duration(seconds: 10));
// // 设置超时20秒
// timeoutTimer = Timer(Duration(seconds: 20), () {
// try {
// if (!isConnected) {
// Navigator.of(context).pop(); // 先关闭 dialog
// WidgetsBinding.instance.addPostFrameCallback((_) {
// TopSlideNotification.show(
// context,
// text: "设备连接超时,请重试".tr,
// textColor: themeController.currentColor.sc9,
// );
// });
// FlutterBluePlus.stopScan();
// }
// } catch (e) {
// print(e);
// }
// });
// // 监听扫描结果
// StreamSubscription<List<ScanResult>>? scanSubscription;
// scanSubscription = FlutterBluePlus.scanResults.listen((results) async {
// // 过滤出符合条件的设备
// ScanResult? targetDevice;
// for (var r in results) {
// if (r.advertisementData.manufacturerData.containsKey(0xFFED)) {
// List<int> rawData = r.advertisementData.manufacturerData[0xFFED]!;
// BleDeviceData deviceData = parseBleData(rawData);
// String deviceMac =
// deviceData.deviceId.replaceAll(':', '').toLowerCase();
// if (deviceMac == mac.toLowerCase()) {
// targetDevice = r;
// break;
// }
// }
// }
// if (targetDevice != null && !isConnected) {
// isConnected = true;
// FlutterBluePlus.stopScan();
// scanSubscription?.cancel();
// timeoutTimer?.cancel();
// try {
// // 连接设备
// // await targetDevice.device.connect();
// THapp bledevice = THapp(device: targetDevice.device);
// await bledevice.device.connect();
// var res2 = bledevice.isConnected;
// if (res2) {
// Navigator.pop(context);
// TopSlideNotification.show(
// context,
// text: "蓝牙绑定.连接成功".tr,
// textColor: themeController.currentColor.sc2,
// );
// blueteethBindController.currentDevice = bledevice;
// if (lisObj != null) {
// lisObj!.cancel();
// }
// var aa;
// lisObj = blueteethBindController.currentDevice!.statusStream
// .listen((onData) async {
// if (onData.status == BleEventType.recvLineLog) {
// final line = onData.val;
// print("[bleee]:" + line);
// }
// if (onData.status == BleEventType.ready) {
// aa = await getDeviceNetVersion(
// blueteethBindController.currentDevice!, 1);
// if (aa == "4g") {
// // TopSlideNotification.show(
// // Get.context!,
// // text: "4g设备配置wifi提示".tr,
// // textColor: themeController.currentColor.sc9,
// // );
// WidgetsBinding.instance.addPostFrameCallback((_) {
// TopSlideNotification.show(
// context,
// text: "4g设备配置wifi提示".tr,
// textColor: themeController.currentColor.sc9,
// );
// });
// return;
// } else {
// Get.toNamed("/wifiPage", arguments: 2);
// }
// }
// });
// // Get.toNamed("/wifiPage", arguments: {bledevice});
// } else {
// Navigator.pop(context);
// TopSlideNotification.show(
// context,
// text: "蓝牙绑定.连接失败".tr,
// textColor: themeController.currentColor.sc9,
// );
// }
// } catch (e) {
// Navigator.of(Get.context!).pop(); // 关闭加载对话框
// TopSlideNotification.show(
// Get.context!,
// text: "设备连接失败".tr,
// textColor: themeController.currentColor.sc9,
// );
// }
// }
// });
// // 等待扫描完成
// await Future.delayed(Duration(seconds: 20));
// } catch (e) {
// timeoutTimer?.cancel();
// Navigator.of(Get.context!).pop(); // 关闭加载对话框
// TopSlideNotification.show(
// Get.context!,
// text: "扫描过程中发生错误".tr,
// textColor: themeController.currentColor.sc9,
// );
// } finally {
// timeoutTimer?.cancel();
// await FlutterBluePlus.stopScan();
// }
}
double _calculateMaxMenuItemWidth(List<String> texts, TextStyle style) {

View File

@@ -206,8 +206,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
flex: 1,
Flexible(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -286,8 +286,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
.addToEnd(SizedBox(height: 36.rpx)),
),
),
Expanded(
flex: 1,
Flexible(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -325,43 +325,43 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
),
].divide(SizedBox(height: 34.rpx)),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${device['code'] ?? '未知数据'.tr}',
// "D11250300003",
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
'${device['person']?['weight'] ?? '未知数据'.tr}kg',
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(SizedBox(height: 34.rpx)),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${device['code'] ?? '未知数据'.tr}',
// "D11250300003",
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
'${device['person']?['weight'] ?? '未知数据'.tr}kg',
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(SizedBox(height: 34.rpx)),
),
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(SizedBox(width: 37.rpx)),

View File

@@ -105,8 +105,8 @@ class _MessageReviewPageState extends State<MessageReviewPage> {
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
flex: 1,
Flexible(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -181,8 +181,8 @@ class _MessageReviewPageState extends State<MessageReviewPage> {
.addToEnd(SizedBox(height: 36.rpx)),
),
),
Expanded(
flex: 1,
Flexible(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -218,36 +218,42 @@ class _MessageReviewPageState extends State<MessageReviewPage> {
),
].divide(SizedBox(height: 34.rpx)),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${widget.data['code'] ?? '未知数据'.tr}',
// "D11250300003",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
Text(
'${widget.data['person']?['weight'] ?? '未知数据'.tr}kg',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(SizedBox(height: 34.rpx)),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${widget.data['code'] ?? '未知数据'.tr}',
// "D11250300003",
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
'${widget.data['person']?['weight'] ?? '未知数据'.tr}kg',
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(SizedBox(height: 34.rpx)),
),
),
]
.divide(SizedBox(width: 33.rpx))