This commit is contained in:
wyf
2025-06-27 17:40:53 +08:00
parent cee6c75f26
commit 7930e3eb2c
3 changed files with 49 additions and 30 deletions

View File

@@ -67,17 +67,12 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
blueteethBindController.updateAll();
}
@override
@override
void dispose() {
_isDisposed = true;
_cleanupResources();
try {
THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device);
bledevice.disconnect();
DailyLogUtils.writeLog("关闭蓝牙连接成功");
} catch (e) {
DailyLogUtils.writeError("关闭蓝牙连接失败");
}
_disconnectDevice();
super.dispose();
}
@@ -1105,4 +1100,14 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
onFailure: (res) {},
);
}
void _disconnectDevice() async {
try {
THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device);
await bledevice.disconnect();
DailyLogUtils.writeLog("关闭蓝牙连接成功");
} catch (e) {
DailyLogUtils.writeError("关闭蓝牙连接失败: $e");
}
}
}

View File

@@ -2,6 +2,7 @@ import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
@@ -80,17 +81,17 @@ class _HomeDeviceStausWidgetState extends State<HomeDeviceStausWidget> {
WebviewTestController webviewTestController = Get.find();
var future = webviewTestController.web.jsbridge?.dart
.appToHtmlDevice(device);
Future.delayed(Duration(seconds: 5), () {
Future.delayed(Duration(seconds: 5), () {
return;
});
await future;
await future;
await webviewTestController.web.jsbridge?.dart
.pageActive();
MainPageBBottomChange.jumpTo(2);
} catch (e) {
print("发生异常: $e");
DailyLogUtils.writeError("发生异常: $e");
}
},
colors:
AppConstants().mhtButtongradientColors, // 你原本没有渐变,单色即可
enableGradient: true, // 关闭渐变