更新分享
This commit is contained in:
@@ -41,7 +41,7 @@ class _SingleBlueteethDeviceCompoentWidgetState
|
||||
deviceData.rssi = widget.bleDevice.rssi;
|
||||
deviceData.mac = deviceData.deviceId.replaceAll(':', '');
|
||||
BleDeviceData device = deviceData;
|
||||
device = blueteethBindController.model.devicelist!.firstWhere(
|
||||
device = blueteethBindController.model.betDevicelist!.firstWhere(
|
||||
(d) => d.mac == device.mac,
|
||||
orElse: () => device,
|
||||
);
|
||||
@@ -64,15 +64,12 @@ class _SingleBlueteethDeviceCompoentWidgetState
|
||||
onConfirm: () async {
|
||||
ApiResponse response =
|
||||
await blueteethBindController.bindDeviceAndMAC(device);
|
||||
TopSlideNotification.show(context, text: response.msg!);
|
||||
if (response.code == HttpStatusCodes.ok) {
|
||||
showLoadingDialog(context); // 显示 loading
|
||||
BLEDevice bledevice =
|
||||
BLEDevice(device: widget.bleDevice.device);
|
||||
var res1 = bledevice.isConnected;
|
||||
print("res1: $res1");
|
||||
THapp bledevice = THapp(device: widget.bleDevice.device);
|
||||
await bledevice.device.connect();
|
||||
var res2 = bledevice.isConnected;
|
||||
print("res2: $res2");
|
||||
if (res2) {
|
||||
Navigator.pop(context);
|
||||
TopSlideNotification.show(
|
||||
@@ -94,7 +91,7 @@ class _SingleBlueteethDeviceCompoentWidgetState
|
||||
} else {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "蓝牙绑定.连接异常".tr,
|
||||
text: response.msg ?? "蓝牙绑定.连接异常".tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
}
|
||||
@@ -104,6 +101,7 @@ class _SingleBlueteethDeviceCompoentWidgetState
|
||||
// 执行取消后的处理逻辑
|
||||
},
|
||||
);
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
Navigator.pop(context);
|
||||
|
||||
Reference in New Issue
Block a user