更新睡眠报告提示样式,更新ios蓝牙开关判定

This commit is contained in:
wyf
2025-09-04 11:20:44 +08:00
parent aad3a00ac3
commit 9f73a8111a
12 changed files with 1845 additions and 277 deletions

View File

@@ -8,6 +8,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.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';
@@ -70,6 +71,9 @@ class _InstantBodyPageState extends State<InstantBodyPage>
void _initWebSocket() {
// 发送WebSocket请求
edm.EasyDartModule.logger
.info("[webscoekt]发送请求:数据-->${{"mac": widget.personInfo['mac']}}");
DailyLogUtils.writeLog("[webscoekt]发送请求:数据-->${{"mac": widget.personInfo['mac']}}");
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
path: "/vsbs/web/rt/marttress",
type: 1,
@@ -606,22 +610,20 @@ class _InstantBodyPageState extends State<InstantBodyPage>
"MAC号".tr +
": ${widget.personInfo['mac'] ?? '未知数据'.tr}",
style: TextStyle(
color: themeController.currentColor.sc4
.withOpacity(0.2),
color: themeController.currentColor.sc4,
fontSize:
AppConstants().smaller_text_fontSize,
AppConstants().middler_text_fontSize,
),
),
SizedBox(
height: 10.rpx,
height: 4.rpx,
),
Text(
"睡眠报告提示".tr,
style: TextStyle(
color: themeController.currentColor.sc4
.withOpacity(0.2),
color: themeController.currentColor.sc4,
fontSize:
AppConstants().smaller_text_fontSize,
AppConstants().middler_text_fontSize,
),
),
],

View File

@@ -8,6 +8,7 @@ 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/BluetoothHelper.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
@@ -60,6 +61,23 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
Get.find<BlueteethBindController>().startStatusPolling();
blueteethBindController.search.value = "";
blueteethBindController.currentDeviceMac?.value = "";
BluetoothHelper.listenBluetoothState((isOn) {
blueteethBindController.model.bluetooth = isOn;
if (isOn) {
isScanning = false;
_startScanning();
}
blueteethBindController.updateAll();
if (!isOn && !_isDialogShowing) {
_isDialogShowing = true;
blueteethBindController.model.devicelist = [];
blueteethBindController.model.betDevicelist = [];
blueteethBindController.updateAll();
_showBluetoothNotEnabledDialog().then((_) {
_isDialogShowing = false;
});
}
});
}
// 检查蓝牙权限
@@ -77,27 +95,6 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
}
}
// Future<void> _requestBluetoothPermission() async {
// Map<Permission, PermissionStatus> statuses = await [
// Permission.bluetoothScan,
// Permission.bluetoothConnect,
// Permission.location, // Android 12 及以下仍需要位置权限来进行扫描
// ].request();
// bool allGranted = statuses[Permission.bluetoothScan]?.isGranted == true &&
// statuses[Permission.bluetoothConnect]?.isGranted == true &&
// statuses[Permission.location]?.isGranted == true;
// if (allGranted) {
// // 用户授予了权限,开始扫描
// _startScanning();
// _startPeriodicScan();
// } else {
// // 权限被拒绝,提示用户
// _showPermissionDeniedDialog();
// }
// }
Future<void> _requestBluetoothPermission(BuildContext context) async {
Map<Permission, PermissionStatus> statuses = {};
bool dialogShown = false; // 标记是否弹过权限提示弹窗
@@ -200,15 +197,15 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
if (!mounted || isScanning) return;
_scanSubscription?.cancel();
var bluetoothState = await FlutterBluePlus.isOn;
if (!bluetoothState && !_isDialogShowing) {
_isDialogShowing = true;
blueteethBindController.model.blelist = [];
blueteethBindController.updateAll();
await _showBluetoothNotEnabledDialog();
_isDialogShowing = false;
return;
}
// var bluetoothState = await FlutterBluePlus.isOn;
// if (!bluetoothState && !_isDialogShowing) {
// _isDialogShowing = true;
// blueteethBindController.model.blelist = [];
// blueteethBindController.updateAll();
// await _showBluetoothNotEnabledDialog();
// _isDialogShowing = false;
// return;
// }
if (!isScanning) {
setState(() {

File diff suppressed because it is too large Load Diff

View File

@@ -73,7 +73,10 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
RxString? cid = "".obs;
RxBool isScanning = false.obs;
Map<String, Map> localUpgradeMac = {}; //mac 进度
RxMap<String, Map> localUpgradeMac = <String, Map>{}.obs; //mac 进度
String? currentUpgradeVersion;//最新版本号
String? currentUpgradeName;//最新固件名
String? currentUpgradeUrl;//最新固件名
void startStatusPolling() {
updateDeviceStatus().then((res) {

View File

@@ -875,22 +875,20 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
"MAC号".tr +
": ${widget.data['mac'] ?? '未知数据'.tr}",
style: TextStyle(
color: themeController.currentColor.sc4
.withOpacity(0.2),
color: themeController.currentColor.sc4,
fontSize:
AppConstants().smaller_text_fontSize,
AppConstants().middler_text_fontSize,
),
),
SizedBox(
height: 10.rpx,
height: 4.rpx,
),
Text(
"睡眠报告提示".tr,
style: TextStyle(
color: themeController.currentColor.sc4
.withOpacity(0.2),
color: themeController.currentColor.sc4,
fontSize:
AppConstants().smaller_text_fontSize,
AppConstants().middler_text_fontSize,
),
),
],