更新修复设置页填写资料没效果;修复校准;修复进入进入控制页没有提示开启蓝牙;修复切到报告页没有任何数据;修复蓝牙连接超时提醒;修复控制页设备选择栏点击无响应;修复控制页蓝牙连接逻辑,默认连接15s,链接不成功图标就为失败图标,不再进行重连,当切换了设备或者重新进入控制页或者点击失败图标的时候,重新开始连接;修复绑定后的立即分享;修复绑定成功后默认选择一台设备作为首页数据;修复控制页选中操作文字太亮;修复侧滑直接退出;修复从设备列表进入控制页会出现转圈图标;修复睡眠报告无数据居中问题;修复设置更新设备名称无效问题;修复首页由于名字太长把控制按钮挤出去的问题。
This commit is contained in:
Binary file not shown.
@@ -1,9 +1,12 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:ef/ef.dart';
|
import 'package:ef/ef.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||||
|
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||||
import 'package:vbvs_app/model/WebSocketMessage.dart';
|
import 'package:vbvs_app/model/WebSocketMessage.dart';
|
||||||
import 'package:vbvs_app/pages/common/bezier_bottom_navigation_bar.dart';
|
import 'package:vbvs_app/pages/common/bezier_bottom_navigation_bar.dart';
|
||||||
@@ -107,9 +110,21 @@ class _HomePageState extends State<MainPageBBottomChange>
|
|||||||
return Center(child: Text('页面 ${titles[selectedIndex]}'));
|
return Center(child: Text('页面 ${titles[selectedIndex]}'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DateTime? _lastBackPressedTime; // 记录上一次返回的时间
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return PopScope(
|
||||||
|
canPop: false,
|
||||||
|
onPopInvokedWithResult: (disposition, result) async {
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
var flag = await _handleBackPressed(context); // 自定义返回逻辑
|
||||||
|
if (flag) {
|
||||||
|
SystemNavigator.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
backgroundColor: const Color(0xFF011C33),
|
backgroundColor: const Color(0xFF011C33),
|
||||||
body: IndexedStack(
|
body: IndexedStack(
|
||||||
index: selectedIndex,
|
index: selectedIndex,
|
||||||
@@ -122,7 +137,7 @@ class _HomePageState extends State<MainPageBBottomChange>
|
|||||||
path: path,
|
path: path,
|
||||||
titles: titles,
|
titles: titles,
|
||||||
),
|
),
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchTab(int index) {
|
void switchTab(int index) {
|
||||||
@@ -228,4 +243,19 @@ class _HomePageState extends State<MainPageBBottomChange>
|
|||||||
ef.log("[激活控制页面报错]:$e");
|
ef.log("[激活控制页面报错]:$e");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> _handleBackPressed(BuildContext context) async {
|
||||||
|
final currentTime = DateTime.now();
|
||||||
|
|
||||||
|
// 如果上次点击返回键时间为空,或者间隔超过 1 秒
|
||||||
|
if (_lastBackPressedTime == null ||
|
||||||
|
currentTime.difference(_lastBackPressedTime!) > Duration(seconds: 2)) {
|
||||||
|
_lastBackPressedTime = currentTime;
|
||||||
|
// showToast("再按一次退出程序", color: color_warning, closeTime: 2);
|
||||||
|
TopSlideNotification.show(context, text: "再滑一次退出程序".tr);
|
||||||
|
return false; // 阻止退出程序
|
||||||
|
} else {
|
||||||
|
return true; // 允许退出程序
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,6 +272,15 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
|||||||
device: widget.bleDevice.scanResult.device);
|
device: widget.bleDevice.scanResult.device);
|
||||||
blueteethBindController.currentDevice = bledevice;
|
blueteethBindController.currentDevice = bledevice;
|
||||||
blueteethBindController.currentDeviceMac.value = "";
|
blueteethBindController.currentDeviceMac.value = "";
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (homeController
|
||||||
|
.homeSleepDays.value.isNotEmpty) {
|
||||||
|
homeController.selectedDayIndex.value =
|
||||||
|
homeController.homeSleepDays.value.length -
|
||||||
|
1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await homeController.getPersonList();
|
||||||
} else {
|
} else {
|
||||||
blueteethBindController.resumeScanning();
|
blueteethBindController.resumeScanning();
|
||||||
blueteethBindController.currentDeviceMac.value = "";
|
blueteethBindController.currentDeviceMac.value = "";
|
||||||
|
|||||||
@@ -873,7 +873,6 @@ class _MHTCalibrationPageState extends State<MHTCalibrationPage> {
|
|||||||
textColor: themeController.currentColor.sc9,
|
textColor: themeController.currentColor.sc9,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceCalibrationController.statusContext.value = "";
|
deviceCalibrationController.statusContext.value = "";
|
||||||
deviceCalibrationController.bed_calibration.value == 0;
|
deviceCalibrationController.bed_calibration.value == 0;
|
||||||
blueteethBindController.cid?.value = "";
|
blueteethBindController.cid?.value = "";
|
||||||
@@ -907,7 +906,7 @@ class _MHTCalibrationPageState extends State<MHTCalibrationPage> {
|
|||||||
data["side"] = currentCalibrationStep.value == 1 ? "A" : "B";
|
data["side"] = currentCalibrationStep.value == 1 ? "A" : "B";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data['cancel'] = true;
|
// data['cancel'] = true;
|
||||||
requestWithLog(
|
requestWithLog(
|
||||||
logTitle: "设备校准",
|
logTitle: "设备校准",
|
||||||
method: MyHttpMethod.post,
|
method: MyHttpMethod.post,
|
||||||
|
|||||||
@@ -404,6 +404,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
|||||||
queryUrl: queryUrl,
|
queryUrl: queryUrl,
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
personnelList.value = res.data ?? [];
|
personnelList.value = res.data ?? [];
|
||||||
|
updateAll();
|
||||||
},
|
},
|
||||||
onFailure: (res) {
|
onFailure: (res) {
|
||||||
EasyDartModule.logger.warning("请求人员信息列表失败: ${res.msg}");
|
EasyDartModule.logger.warning("请求人员信息列表失败: ${res.msg}");
|
||||||
|
|||||||
@@ -125,8 +125,19 @@ class _MhtSleepReportPageState extends State<MhtSleepReportPage> {
|
|||||||
if (userInfoController.model.login! != null &&
|
if (userInfoController.model.login! != null &&
|
||||||
userInfoController.model.login! == 1) {
|
userInfoController.model.login! == 1) {
|
||||||
final list = deviceController.personnelList.value;
|
final list = deviceController.personnelList.value;
|
||||||
if (list.isNotEmpty &&
|
// if (list.isNotEmpty &&
|
||||||
formFieldController.value == null) {
|
// formFieldController.value == null) {
|
||||||
|
// WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
// formFieldController.value = list[0]["mac"];
|
||||||
|
// personInfo.value = list[0];
|
||||||
|
// homeController.selectPerson.value = list[0];
|
||||||
|
// homeController.selectDevcie.value = list[0]["mac"];
|
||||||
|
// deviceController
|
||||||
|
// .getSleeps(formFieldController.value);
|
||||||
|
// homeController.updateAll();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
if (list.isNotEmpty) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
formFieldController.value = list[0]["mac"];
|
formFieldController.value = list[0]["mac"];
|
||||||
personInfo.value = list[0];
|
personInfo.value = list[0];
|
||||||
@@ -312,7 +323,8 @@ class _MhtSleepReportPageState extends State<MhtSleepReportPage> {
|
|||||||
|
|
||||||
Obx(() {
|
Obx(() {
|
||||||
if (homeController.selectDevcie.value != null &&
|
if (homeController.selectDevcie.value != null &&
|
||||||
homeController.selectDevcie.value!.isNotEmpty)
|
homeController.selectDevcie.value!.isNotEmpty &&
|
||||||
|
deviceController.personnelList.value.isNotEmpty)
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: NewSleepReportPage(
|
child: NewSleepReportPage(
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
Reference in New Issue
Block a user