This commit is contained in:
wyf
2025-11-14 15:12:35 +08:00
parent 7e44998240
commit 18bd13a7b6
18 changed files with 431 additions and 112 deletions

View File

@@ -611,29 +611,32 @@ class _InstantBodyPageState extends State<InstantBodyPage>
SizedBox(
height: 40.rpx,
),
Column(
children: [
Text(
"MAC号".tr +
": ${widget.personInfo['mac'] ?? '未知数据'.tr}",
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize:
AppConstants().middler_text_fontSize,
Padding(
padding: EdgeInsets.fromLTRB(46.rpx, 0, 46.rpx, 0),
child: Column(
children: [
Text(
"MAC号".tr +
": ${widget.personInfo['mac'] ?? '未知数据'.tr}",
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize:
AppConstants().middler_text_fontSize,
),
),
),
SizedBox(
height: 4.rpx,
),
Text(
"睡眠报告提示".tr,
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize:
AppConstants().middler_text_fontSize,
SizedBox(
height: 4.rpx,
),
),
],
Text(
"睡眠报告提示".tr,
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize:
AppConstants().middler_text_fontSize,
),
),
],
),
),
SizedBox(
height: 40.rpx,

View File

@@ -694,9 +694,47 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
),
),
),
// Obx(() {
// if (blueteethBindController
// .model.betDevicelist!.isNotEmpty) {
// return Expanded(
// child: Container(
// width: double.infinity,
// child: SingleChildScrollView(
// child: Column(
// mainAxisSize: MainAxisSize.max,
// children: [
// ...blueteethBindController.model.blelist!
// .map((device) {
// return SingleBlueteethDeviceCompoentWidget(
// // device: device,
// bleDevice: device,
// );
// })
// .toList()
// .divide(SizedBox(height: 30.rpx))
// .addToEnd(SizedBox(height: 30.rpx)),
// ],
// ),
// ),
// ),
// );
// }
// return Container();
// }),
Obx(() {
if (blueteethBindController
.model.betDevicelist!.isNotEmpty) {
// 对 blelist 进行排序(按 rssi 降序)
final sortedList = [
...blueteethBindController.model.blelist!
];
sortedList.sort((a, b) {
final rssiA = a.rssi ?? -999; // 防止空值
final rssiB = b.rssi ?? -999;
return rssiB.compareTo(rssiA); // rssi 大的排前面
});
return Expanded(
child: Container(
width: double.infinity,
@@ -704,10 +742,9 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
...blueteethBindController.model.blelist!
...sortedList
.map((device) {
return SingleBlueteethDeviceCompoentWidget(
// device: device,
bleDevice: device,
);
})

View File

@@ -50,7 +50,7 @@ class _DataShowWidgetState extends State<DataShowWidget> {
children: [
// 放入传入的 widget1
Container(
width: MediaQuery.sizeOf(context).width * 0.33, // 固定宽度
width: MediaQuery.sizeOf(context).width * 0.35, // 固定宽度
decoration: BoxDecoration(),
child: Align(
alignment: Alignment.centerLeft,
@@ -64,7 +64,7 @@ class _DataShowWidgetState extends State<DataShowWidget> {
),
// 放入传入的 widget2
Container(
width: MediaQuery.sizeOf(context).width * 0.15, // 固定宽度
width: MediaQuery.sizeOf(context).width * 0.21, // 固定宽度
decoration: BoxDecoration(),
child: Align(
alignment: widget.alignment == MainAxisAlignment.start
@@ -77,7 +77,7 @@ class _DataShowWidgetState extends State<DataShowWidget> {
),
// 放入传入的 widget3
Container(
width: MediaQuery.sizeOf(context).width * 0.25, // 固定宽度
width: MediaQuery.sizeOf(context).width * 0.29, // 固定宽度
decoration: BoxDecoration(),
child: Align(
alignment: widget.alignment == MainAxisAlignment.start
@@ -89,18 +89,18 @@ class _DataShowWidgetState extends State<DataShowWidget> {
),
),
// 放入传入的 widget4
Container(
width: MediaQuery.sizeOf(context).width * 0.12, // 固定宽度
decoration: BoxDecoration(),
child: Align(
alignment: widget.alignment == MainAxisAlignment.start
? Alignment.centerLeft
: widget.alignment == MainAxisAlignment.center
? Alignment.center
: Alignment.centerRight, // 同样设置对齐
child: widget.widget4, // 显示传入的 widget4
),
),
// Container(
// width: MediaQuery.sizeOf(context).width * 0.12, // 固定宽度
// decoration: BoxDecoration(),
// child: Align(
// alignment: widget.alignment == MainAxisAlignment.start
// ? Alignment.centerLeft
// : widget.alignment == MainAxisAlignment.center
// ? Alignment.center
// : Alignment.centerRight, // 同样设置对齐
// child: widget.widget4, // 显示传入的 widget4
// ),
// ),
],
),
),

View File

@@ -126,7 +126,7 @@ class _BreathPauseWidgetState extends State<BreathPauseWidget> {
),
);
} catch (e) {
es.EasyDartModule.logger.error("打鼾监测绘制异常${e}");
es.EasyDartModule.logger.error("打鼾监测绘制异常${e}");
return Container();
}
}

View File

@@ -77,6 +77,8 @@ class _SnoreViewWidgetWidgetState extends State<BreathePauseNewWidget> {
int roundedMaxTimes = (maxTimes / 10).ceil() * 10;
var startTime = widget.sleepReport['startTime'];
var endTime = widget.sleepReport['endTime'];
if (showLabel.isEmpty) return const SizedBox();
return Container(
width: double.infinity,
decoration: BoxDecoration(

View File

@@ -76,7 +76,8 @@ class _HeartChangeWidgetState extends State<HeartChangeWidget> {
14.rpx, 10.rpx, 14.rpx, 10.rpx), //
borderRadius: 0.rpx, // 圆形点击区域
onTap: () {
if (AppConstants().ent_type == APPPackageType.MHT.code) {
if (AppConstants().ent_type ==
APPPackageType.MHT.code) {
showTipDialog(
context,
Container(
@@ -251,7 +252,9 @@ class _HeartChangeWidgetState extends State<HeartChangeWidget> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: themeController.currentColor.sc3,
color:
getColorByRange(data['value'], data['range']),
// color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize,
),
),
@@ -334,4 +337,33 @@ class _HeartChangeWidgetState extends State<HeartChangeWidget> {
};
}).toList();
}
getColorByRange(double value, String? range) {
try {
// 1. 空、"-"、null 都直接返回默认颜色
if (range == null || range.toString().isEmpty || range == "-") {
return themeController.currentColor.sc3;
}
// 2. 拆分范围,例如 "70-150"
final parts = range.split('-');
if (parts.length != 2) {
return themeController.currentColor.sc3; // 格式不对直接默认
}
final min = int.parse(parts[0].trim());
final max = int.parse(parts[1].trim());
// 3. 判断是否在范围内
if (value < min || value > max) {
// 不在范围 → 返回 danger 色
return themeController.currentColor.sc9;
}
// 在范围 → 正常色
return themeController.currentColor.sc3;
} catch (e) {
// 任意解析错误都回默认
return themeController.currentColor.sc3;
}
}
}

View File

@@ -4,9 +4,11 @@ import 'package:ef/ef.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
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/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/base/THFlutterFlowDropDown.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/enum/APPPackageType.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
@@ -174,9 +176,222 @@ class _HeartPointWidgetState extends State<HeartPointWidget> {
),
),
),
// SizedBox(
// height: 31.rpx,
// ),
SizedBox(
height: 31.rpx,
),
Row(
children: [
Text(
"图形参考".tr,
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().middler_text_fontSize),
),
],
),
SizedBox(
height: 31.rpx,
),
// Row(
// // 使用 start 避免 spaceBetween 抵消 divide 的间隔
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// // 第 1 个
// Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image.asset(
// "assets/img/heartPic1.png",
// width: 120.rpx,
// height: 120.rpx,
// ),
// SizedBox(height: 10),
// Text(
// '正常心率窦性图'.tr, // ← 替换文字
// style: TextStyle(
// fontSize: AppConstants().small_text_fontSize,
// color: themeController.currentColor.sc3),
// ),
// ],
// ),
// // 第 2 个
// Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image.asset(
// "assets/img/heartPic2.png",
// width: 120.rpx,
// height: 120.rpx,
// ),
// SizedBox(height: 10),
// Text(
// '窦性心律不齐图'.tr, // ← 替换文字
// style: TextStyle(
// fontSize: AppConstants().small_text_fontSize,
// color: themeController.currentColor.sc3),
// ),
// ],
// ),
// // 第 3 个
// Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image.asset(
// "assets/img/heartPic3.png",
// width: 120.rpx,
// height: 120.rpx,
// ),
// SizedBox(height: 10),
// Text(
// '持续性房颤图'.tr, // ← 替换文字
// style: TextStyle(
// fontSize: AppConstants().small_text_fontSize,
// color: themeController.currentColor.sc3),
// ),
// ],
// ),
// // 第 4 个
// Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image.asset(
// "assets/img/heartPic3.png",
// width: 120.rpx,
// height: 120.rpx,
// ),
// SizedBox(height: 10),
// Text(
// '阵法性房颤图'.tr, // ← 替换文字
// style: TextStyle(
// fontSize: AppConstants().small_text_fontSize,
// color: themeController.currentColor.sc3),
// ),
// ],
// ),
// ].divide(
// SizedBox(width: 20.rpx),
// ),
// )
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// 第 1 个
SizedBox(
width: (MediaQuery.sizeOf(context).width - 60.rpx * 3) / 4,
child: Column(
children: [
Image.asset(
"assets/img/heartPic1.png",
width: 120.rpx,
height: 120.rpx,
),
SizedBox(height: 10),
SizedBox(
height: 60.rpx, // 👈 固定说明文字高度
child: Text(
'正常心率窦性图'.tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: AppConstants().small_text_fontSize,
color: themeController.currentColor.sc3,
),
),
),
],
),
),
// 第 2 个
SizedBox(
width: (MediaQuery.sizeOf(context).width - 60.rpx * 3) / 4,
child: Column(
children: [
Image.asset(
"assets/img/heartPic2.png",
width: 120.rpx,
height: 120.rpx,
),
SizedBox(height: 10),
SizedBox(
height: 60.rpx,
child: Text(
'窦性心律不齐图'.tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: AppConstants().small_text_fontSize,
color: themeController.currentColor.sc3,
),
),
),
],
),
),
// 第 3 个
SizedBox(
width: (MediaQuery.sizeOf(context).width - 60.rpx * 3) / 4,
child: Column(
children: [
Image.asset(
"assets/img/heartPic3.png",
width: 120.rpx,
height: 120.rpx,
),
SizedBox(height: 10),
SizedBox(
height: 60.rpx,
child: Text(
'持续性房颤图'.tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: AppConstants().small_text_fontSize,
color: themeController.currentColor.sc3,
),
),
),
],
),
),
// 第 4 个
SizedBox(
width: (MediaQuery.sizeOf(context).width - 60.rpx * 3) / 4,
child: Column(
children: [
Image.asset(
"assets/img/heartPic3.png",
width: 120.rpx,
height: 120.rpx,
),
SizedBox(height: 10),
SizedBox(
height: 60.rpx,
child: Text(
'阵法性房颤图'.tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: AppConstants().small_text_fontSize,
color: themeController.currentColor.sc3,
),
),
),
],
),
),
].divide(SizedBox(width: 20.rpx)),
),
],
),
),

View File

@@ -877,63 +877,64 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
// }
// }),
Obx(() {
if (sleepReportController.isLoading.value) {
return Center(
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
if (sleepReportController.isLoading.value) {
return Center(
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
),
);
}
switch (sleepReportController.model.type) {
case 1:
return DailyDataWidget(
sleepReport,
sleepCardKey,
heartRateCardKey,
breatheCardKey,
widget.data);
case 2:
return WeekDataWidget(
sleepReport,
widget.data,
);
}
switch (sleepReportController.model.type) {
case 1:
return DailyDataWidget(
sleepReport,
sleepCardKey,
heartRateCardKey,
breatheCardKey,
widget.data);
case 2:
return WeekDataWidget(
sleepReport,
widget.data,
);
case 3:
return MonthDataWidget(
sleepReport,
widget.data,
);
default:
return NullDataWidget();
}
case 3:
return MonthDataWidget(
sleepReport,
widget.data,
);
default:
return NullDataWidget();
}
}),
Column(
children: [
Text(
"MAC号".tr +
": ${widget.data['mac'] ?? '未知数据'.tr}",
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize:
AppConstants().middler_text_fontSize,
Padding(
padding: EdgeInsets.fromLTRB(46.rpx, 0, 46.rpx, 0),
child: Column(
children: [
Text(
"MAC号".tr +
": ${widget.data['mac'] ?? '未知数据'.tr}",
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize:
AppConstants().middler_text_fontSize,
),
),
),
SizedBox(
height: 4.rpx,
),
Text(
"睡眠报告提示".tr,
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize:
AppConstants().middler_text_fontSize,
SizedBox(
height: 4.rpx,
),
),
],
Text(
"睡眠报告提示".tr,
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize:
AppConstants().middler_text_fontSize,
),
),
],
),
),
SizedBox(
height: 40.rpx,