更新睡眠报告
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:permission_handler/permission_handler.dart'; // 引入permission_handler
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
@@ -15,6 +16,7 @@ import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/BleDeviceData.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
|
||||
class BlueteethDevicePage extends StatefulWidget {
|
||||
int tid = -1;
|
||||
@@ -730,19 +732,40 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
|
||||
}
|
||||
|
||||
_showBluetoothNotEnabledDialog() async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: Text("蓝牙未开启"),
|
||||
content: Text("请先打开蓝牙再进行设备扫描"),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text("知道了"),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
await showTipDialog(
|
||||
context,
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
"蓝牙未开启".tr,
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants().title_text_fontSize,
|
||||
color: themeController.currentColor.sc3),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.rpx,
|
||||
),
|
||||
Text(
|
||||
"请先打开蓝牙在进行设备扫描".tr,
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
color: themeController.currentColor.sc3),
|
||||
),
|
||||
],
|
||||
));
|
||||
// await showDialog(
|
||||
// context: context,
|
||||
// builder: (_) => AlertDialog(
|
||||
// title: Text("蓝牙未开启"),
|
||||
// content: Text("请先打开蓝牙再进行设备扫描"),
|
||||
// actions: [
|
||||
// TextButton(
|
||||
// onPressed: () => Navigator.of(context).pop(),
|
||||
// child: Text("知道了"),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -860,7 +860,7 @@ void showWifiDialog(
|
||||
);
|
||||
}
|
||||
|
||||
void showTipDialog(
|
||||
String showTipDialog(
|
||||
BuildContext context,
|
||||
Widget widget, {
|
||||
Color? backgroundColor, // 新增可选参数
|
||||
@@ -990,4 +990,5 @@ void showTipDialog(
|
||||
);
|
||||
},
|
||||
);
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ class _WifiPageState extends State<WifiPage> {
|
||||
// textColor: themeController.currentColor.sc2,
|
||||
// );
|
||||
// });
|
||||
blueteethBindController.blueConnectFlag.value = 2;
|
||||
blueteethBindController.currentDevice = bledevice;
|
||||
if (lisObj != null) {
|
||||
lisObj!.cancel();
|
||||
@@ -116,6 +117,8 @@ class _WifiPageState extends State<WifiPage> {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
blueteethBindController.blueConnectFlag.value = 0;
|
||||
blueteethBindController.updateAll();
|
||||
dealWifi(widget.type['mac']).then((aa) {
|
||||
print("object");
|
||||
});
|
||||
@@ -175,21 +178,50 @@ class _WifiPageState extends State<WifiPage> {
|
||||
SizedBox(
|
||||
width: 14.rpx,
|
||||
),
|
||||
Obx(() {
|
||||
if (blueteethBindController.connectStatus.value ==
|
||||
0) {
|
||||
return SizedBox(
|
||||
width: 24.rpx,
|
||||
height: 24.rpx,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 1,
|
||||
valueColor:
|
||||
AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
}),
|
||||
if (widget.type == null)
|
||||
Obx(() {
|
||||
if (blueteethBindController.connectStatus.value ==
|
||||
0) {
|
||||
return SizedBox(
|
||||
width: 24.rpx,
|
||||
height: 24.rpx,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 1,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
}),
|
||||
if (widget.type != null)
|
||||
Obx(() {
|
||||
if (blueteethBindController.blueConnectFlag.value ==
|
||||
0) {
|
||||
return SizedBox(
|
||||
width: 24.rpx,
|
||||
height: 24.rpx,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 1,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (blueteethBindController.connectStatus.value ==
|
||||
0&&blueteethBindController.blueConnectFlag.value ==0) {
|
||||
return SizedBox(
|
||||
width: 24.rpx,
|
||||
height: 24.rpx,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 1,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
}),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -717,6 +749,20 @@ class _WifiPageState extends State<WifiPage> {
|
||||
horizontal: 20.rpx, vertical: 10.rpx),
|
||||
borderRadius: 20.rpx,
|
||||
onTap: () async {
|
||||
if ((blueteethBindController
|
||||
.blueConnectFlag ==
|
||||
0 ||
|
||||
blueteethBindController
|
||||
.blueConnectFlag ==
|
||||
1) &&
|
||||
widget.type != null) {
|
||||
blueteethBindController
|
||||
.blueConnectFlag.value = 0;
|
||||
dealWifi(widget.type['mac']).then((aa) {
|
||||
print("object");
|
||||
});
|
||||
return;
|
||||
}
|
||||
blueteethBindController
|
||||
.connectStatus.value = 0;
|
||||
blueteethBindController.updateAll();
|
||||
@@ -957,6 +1003,8 @@ class _WifiPageState extends State<WifiPage> {
|
||||
timeoutTimer = Timer(Duration(seconds: 20), () {
|
||||
try {
|
||||
if (!isConnected) {
|
||||
blueteethBindController.blueConnectFlag.value = 1;
|
||||
blueteethBindController.updateAll();
|
||||
// Navigator.of(context).pop(); // 先关闭 dialog
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
TopSlideNotification.show(
|
||||
@@ -1005,6 +1053,7 @@ class _WifiPageState extends State<WifiPage> {
|
||||
var res2 = bledevice.isConnected;
|
||||
if (res2) {
|
||||
// Navigator.pop(context);
|
||||
blueteethBindController.blueConnectFlag.value = 2;
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "蓝牙绑定.连接成功".tr,
|
||||
|
||||
Reference in New Issue
Block a user