更新快检功能必传mac参数
This commit is contained in:
@@ -272,10 +272,14 @@ class _QcBreatheStandardWidgetState extends State<QcBreatheStandardWidget> {
|
||||
EdgeInsetsDirectional.fromSTEB(0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildBreathItem(avgBreath),
|
||||
_buildBreathItem(baseBreath),
|
||||
_buildBreathItem(minBreath),
|
||||
_buildBreathItem(maxBreath),
|
||||
_buildBreathItem(avgBreath,
|
||||
valueColor: stringToColor("#00C1AA")),
|
||||
_buildBreathItem(baseBreath,
|
||||
valueColor: stringToColor("#FF7159")),
|
||||
_buildBreathItem(minBreath,
|
||||
valueColor: stringToColor("#E3AFDD")),
|
||||
_buildBreathItem(maxBreath,
|
||||
valueColor: stringToColor("#FF9F66")),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -289,7 +293,7 @@ class _QcBreatheStandardWidgetState extends State<QcBreatheStandardWidget> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildBreathItem(Map<String, dynamic> data) {
|
||||
Widget _buildBreathItem(Map<String, dynamic> data, {Color? valueColor}) {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.rpx, vertical: 4.rpx),
|
||||
@@ -322,7 +326,7 @@ class _QcBreatheStandardWidgetState extends State<QcBreatheStandardWidget> {
|
||||
child: Text(
|
||||
"${data['value']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
color: valueColor ?? themeController.currentColor.sc2,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
maxLines: 2,
|
||||
@@ -330,7 +334,7 @@ class _QcBreatheStandardWidgetState extends State<QcBreatheStandardWidget> {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4.rpx),
|
||||
SizedBox(width: 6.rpx),
|
||||
Flexible(
|
||||
fit: FlexFit.loose,
|
||||
child: Text(
|
||||
|
||||
@@ -1,3 +1,219 @@
|
||||
// import 'package:ef/ef.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/tool/ClickableContainer.dart';
|
||||
// import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||
// import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
// import 'package:vbvs_app/pages/sleep_report/chart/FatigueCircleIndicator.dart';
|
||||
// import 'package:EasyDartModule/EasyDartModule.dart' as es;
|
||||
|
||||
// class QcHeartHealthWidget extends StatefulWidget {
|
||||
// var reportData; // 改为更通用的名称
|
||||
// QcHeartHealthWidget({super.key, required this.reportData});
|
||||
|
||||
// @override
|
||||
// State<QcHeartHealthWidget> createState() => _QcHeartHealthWidgetState();
|
||||
// }
|
||||
|
||||
// class _QcHeartHealthWidgetState extends State<QcHeartHealthWidget> {
|
||||
// @override
|
||||
// void setState(VoidCallback callback) {
|
||||
// super.setState(callback);
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void dispose() {
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// try {
|
||||
// if (widget.reportData == null) {
|
||||
// return Container();
|
||||
// }
|
||||
|
||||
// // 从reportData中获取xljk数据
|
||||
// List xljkData = widget.reportData['xljk'] ?? [];
|
||||
// if (xljkData.isEmpty) {
|
||||
// return Container();
|
||||
// }
|
||||
|
||||
// var showLabel = convertMentalHealthData(xljkData);
|
||||
|
||||
// // 如果没有有效数据,不显示组件
|
||||
// if (showLabel.isEmpty) {
|
||||
// return Container();
|
||||
// }
|
||||
|
||||
// return Container(
|
||||
// width: double.infinity,
|
||||
// decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5,
|
||||
// borderRadius: BorderRadius.circular(
|
||||
// AppConstants().normal_container_radius), // 你可以按需调整圆角半径
|
||||
// ),
|
||||
// child: Padding(
|
||||
// padding:
|
||||
// EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 0.rpx),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Container(
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// "心理健康评估".tr,
|
||||
// style: TextStyle(
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontSize: AppConstants().title_text_fontSize),
|
||||
// ),
|
||||
// ClickableContainer(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor: Colors.white, // 或设置为你需要的水波纹颜色
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(
|
||||
// 14.rpx, 10.rpx, 14.rpx, 10.rpx), //
|
||||
// borderRadius: 0.rpx, // 圆形点击区域
|
||||
// onTap: () {
|
||||
// if (AppConstants().ent_type ==
|
||||
// APPPackageType.MHT.code) {
|
||||
// showTipDialog(
|
||||
// context,
|
||||
// Container(
|
||||
// child: Text(
|
||||
// "心率健康评估主要通过用户睡眠报告中的时间点、体征数据及HRV数据等信息,来判断其心理健康水平、疲劳程度。"
|
||||
// .tr,
|
||||
// style: TextStyle(
|
||||
// fontSize: 26.rpx,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor: Color(0xFFFFFFFF),
|
||||
// colors: [
|
||||
// Color(0XFF1592AA),
|
||||
// Color(0xFF0C83A7),
|
||||
// Color(0xFF006FA3)
|
||||
// ],
|
||||
// );
|
||||
// } else {
|
||||
// showTipDialog(
|
||||
// context,
|
||||
// Container(
|
||||
// child: Text(
|
||||
// "心率健康评估主要通过用户睡眠报告中的时间点、体征数据及HRV数据等信息,来判断其心理健康水平、疲劳程度。"
|
||||
// .tr,
|
||||
// style: TextStyle(
|
||||
// fontSize: 26.rpx,
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor: themeController.currentColor.sc17,
|
||||
// colors: AppConstants().thNormalButton,
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// child: Container(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(
|
||||
// 0, 0.rpx, 0.rpx, 0), // 外部 padding 移到内部
|
||||
// width: 28.rpx,
|
||||
// height: 28.rpx,
|
||||
// child: SvgPicture.asset(
|
||||
// 'assets/img/icon/explain.svg',
|
||||
// fit: BoxFit.cover,
|
||||
// color: themeController.currentColor.sc4,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 104.rpx,
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(
|
||||
// 30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// if (showLabel.length > 0)
|
||||
// Flexible(
|
||||
// flex: 1,
|
||||
// child: FatigueCircleIndicator(
|
||||
// data: showLabel[0],
|
||||
// ),
|
||||
// ),
|
||||
// if (showLabel.length > 1)
|
||||
// Flexible(
|
||||
// flex: 1,
|
||||
// child: FatigueCircleIndicator(
|
||||
// data: showLabel[1],
|
||||
// ),
|
||||
// ),
|
||||
// ].divide(SizedBox(
|
||||
// width: 110.rpx,
|
||||
// )),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 72.rpx,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// } catch (e) {
|
||||
// es.EasyDartModule.logger.error("心理健康绘制异常${e}");
|
||||
// return Container();
|
||||
// }
|
||||
// }
|
||||
|
||||
// List<Map<String, dynamic>> convertMentalHealthData(List data) {
|
||||
// return data.map<Map<String, dynamic>>((item) {
|
||||
// final String? colorStr = item['color'];
|
||||
// final int value = item['val'].toInt() ?? 0; // 注意这里从val取值
|
||||
// final String explain =
|
||||
// (item['tips'] != null && (item['tips'] as String).trim().isNotEmpty)
|
||||
// ? item['tips']
|
||||
// : '未知数据'.tr;
|
||||
|
||||
// // 根据value值确定level描述
|
||||
// String level = '';
|
||||
// if (value <= 30) {
|
||||
// level = '较低';
|
||||
// } else if (value <= 60) {
|
||||
// level = '正常';
|
||||
// } else if (value <= 80) {
|
||||
// level = '偏高';
|
||||
// } else {
|
||||
// level = '严重';
|
||||
// }
|
||||
|
||||
// return {
|
||||
// 'name': item['name'] ?? '未知指标',
|
||||
// 'color': colorStr != null && colorStr.isNotEmpty
|
||||
// ? stringToColor(colorStr)
|
||||
// : stringToColor("#00C1AA"), // 默认颜色
|
||||
// 'percent': value,
|
||||
// 'explain': level, // 使用计算出的level
|
||||
// "bottomColor": stringToColor("#393D49"),
|
||||
// };
|
||||
// }).toList();
|
||||
// }
|
||||
// }
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
@@ -20,6 +236,9 @@ class QcHeartHealthWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _QcHeartHealthWidgetState extends State<QcHeartHealthWidget> {
|
||||
// 缓存xljk的配置数据,用于根据level获取对应的name
|
||||
Map<int, String>? _xljkNameMap;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
@@ -28,6 +247,7 @@ class _QcHeartHealthWidgetState extends State<QcHeartHealthWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initXljkConfig();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -35,6 +255,44 @@ class _QcHeartHealthWidgetState extends State<QcHeartHealthWidget> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// 初始化xljk配置映射
|
||||
void _initXljkConfig() {
|
||||
try {
|
||||
if (widget.reportData == null) return;
|
||||
|
||||
Map<String, dynamic> typeData = widget.reportData['type'] ?? {};
|
||||
List<dynamic> xljkConfigList = typeData['xljk'] ?? [];
|
||||
|
||||
if (xljkConfigList.isNotEmpty) {
|
||||
_xljkNameMap = {};
|
||||
for (var config in xljkConfigList) {
|
||||
int level = config['level'] ?? 0;
|
||||
_xljkNameMap![level] = config['name'] ?? '未知';
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
es.EasyDartModule.logger.error("初始化xljk配置异常:$e");
|
||||
}
|
||||
}
|
||||
|
||||
// 辅助方法:将颜色字符串转换为Color对象
|
||||
Color _getColorFromString(String colorStr) {
|
||||
try {
|
||||
// 如果颜色字符串以#开头,直接使用
|
||||
if (colorStr.startsWith('#')) {
|
||||
return Color(int.parse('0xFF${colorStr.substring(1)}'));
|
||||
}
|
||||
// 如果是6位十六进制颜色码(不带#)
|
||||
else if (colorStr.length == 6) {
|
||||
return Color(int.parse('0xFF$colorStr'));
|
||||
}
|
||||
} catch (e) {
|
||||
es.EasyDartModule.logger.error("颜色转换异常:$e");
|
||||
}
|
||||
// 默认返回主题色
|
||||
return themeController.currentColor.sc3;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
try {
|
||||
@@ -42,7 +300,7 @@ class _QcHeartHealthWidgetState extends State<QcHeartHealthWidget> {
|
||||
return Container();
|
||||
}
|
||||
|
||||
// 从reportData中获取xljk数据
|
||||
// 从reportData中获取xljk数据(这是实际的心率健康数据)
|
||||
List xljkData = widget.reportData['xljk'] ?? [];
|
||||
if (xljkData.isEmpty) {
|
||||
return Container();
|
||||
@@ -183,32 +441,39 @@ class _QcHeartHealthWidgetState extends State<QcHeartHealthWidget> {
|
||||
List<Map<String, dynamic>> convertMentalHealthData(List data) {
|
||||
return data.map<Map<String, dynamic>>((item) {
|
||||
final String? colorStr = item['color'];
|
||||
final int value = item['val'].toInt() ?? 0; // 注意这里从val取值
|
||||
final int value = item['val']?.toInt() ?? 0;
|
||||
final int level = item['level'] ?? 0; // 获取level值
|
||||
final String explain =
|
||||
(item['tips'] != null && (item['tips'] as String).trim().isNotEmpty)
|
||||
? item['tips']
|
||||
: '未知数据'.tr;
|
||||
|
||||
// 根据value值确定level描述
|
||||
String level = '';
|
||||
if (value <= 30) {
|
||||
level = '较低';
|
||||
} else if (value <= 60) {
|
||||
level = '正常';
|
||||
} else if (value <= 80) {
|
||||
level = '偏高';
|
||||
// 从配置映射中获取对应的name,如果没有则使用默认级别描述
|
||||
String levelName;
|
||||
if (_xljkNameMap != null && _xljkNameMap!.containsKey(level)) {
|
||||
levelName = _xljkNameMap![level]!;
|
||||
} else {
|
||||
level = '严重';
|
||||
// 默认级别判断逻辑
|
||||
if (value <= 30) {
|
||||
levelName = '较低';
|
||||
} else if (value <= 60) {
|
||||
levelName = '正常';
|
||||
} else if (value <= 80) {
|
||||
levelName = '偏高';
|
||||
} else {
|
||||
levelName = '严重';
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'name': item['name'] ?? '未知指标',
|
||||
'color': colorStr != null && colorStr.isNotEmpty
|
||||
? stringToColor(colorStr)
|
||||
: stringToColor("#00C1AA"), // 默认颜色
|
||||
? _getColorFromString(colorStr)
|
||||
: _getColorFromString("#00C1AA"), // 默认颜色
|
||||
'percent': value,
|
||||
'explain': level, // 使用计算出的level
|
||||
"bottomColor": stringToColor("#393D49"),
|
||||
'explain': levelName, // 使用从配置获取的levelName或默认级别
|
||||
'level': level, // 保留level信息
|
||||
"bottomColor": _getColorFromString("#393D49"),
|
||||
};
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ class _QcHeartRateStandardWidgetState extends State<QcHeartRateStandardWidget> {
|
||||
baseValue: hrData['base'].toDouble(), // 传入基准值
|
||||
// baseValue: 65, // 传入基准值
|
||||
baseLabel: '基准', // 可选的自定义标签
|
||||
yAxisPadding: 20,
|
||||
yAxisPadding: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -276,10 +276,14 @@ class _QcHeartRateStandardWidgetState extends State<QcHeartRateStandardWidget> {
|
||||
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildHeartRateItem(avgHeartRate),
|
||||
_buildHeartRateItem(baseHeartRate),
|
||||
_buildHeartRateItem(minHeartRate),
|
||||
_buildHeartRateItem(maxHeartRate),
|
||||
_buildHeartRateItem(avgHeartRate,
|
||||
valueColor: stringToColor("#00C1AA")),
|
||||
_buildHeartRateItem(baseHeartRate,
|
||||
valueColor: stringToColor("#FF7159")),
|
||||
_buildHeartRateItem(minHeartRate,
|
||||
valueColor: stringToColor("#E3AFDD")),
|
||||
_buildHeartRateItem(maxHeartRate,
|
||||
valueColor: stringToColor("#FF9F66")),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -298,7 +302,7 @@ class _QcHeartRateStandardWidgetState extends State<QcHeartRateStandardWidget> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildHeartRateItem(Map<String, dynamic> data) {
|
||||
Widget _buildHeartRateItem(Map<String, dynamic> data, {Color? valueColor}) {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.rpx, vertical: 4.rpx),
|
||||
@@ -331,7 +335,7 @@ class _QcHeartRateStandardWidgetState extends State<QcHeartRateStandardWidget> {
|
||||
child: Text(
|
||||
"${data['value']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
color: valueColor ?? themeController.currentColor.sc2,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
maxLines: 2,
|
||||
|
||||
@@ -1,3 +1,243 @@
|
||||
// import 'package:ef/ef.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_svg/svg.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/tool/ClickableContainer.dart';
|
||||
// import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||
// import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
// import 'package:vbvs_app/pages/sleep_report/chart/StatusBarWithIndicator.dart';
|
||||
// import 'package:EasyDartModule/EasyDartModule.dart' as es;
|
||||
|
||||
// class QcPiLaoZhiShuPercentWidget extends StatefulWidget {
|
||||
// var reportData; // 改为更通用的名称
|
||||
// QcPiLaoZhiShuPercentWidget({super.key, required this.reportData});
|
||||
|
||||
// @override
|
||||
// State<QcPiLaoZhiShuPercentWidget> createState() =>
|
||||
// _PiLaoZhiShuPercentWidgetState();
|
||||
// }
|
||||
|
||||
// class _PiLaoZhiShuPercentWidgetState extends State<QcPiLaoZhiShuPercentWidget> {
|
||||
// @override
|
||||
// void setState(VoidCallback callback) {
|
||||
// super.setState(callback);
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void dispose() {
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// try {
|
||||
// if (widget.reportData == null) {
|
||||
// return Container();
|
||||
// }
|
||||
|
||||
// // 从reportData中获取plzs数据
|
||||
// Map<String, dynamic> plzsData = widget.reportData['plzs'] ?? {};
|
||||
// if (plzsData.isEmpty) {
|
||||
// return Container();
|
||||
// }
|
||||
|
||||
// int level = plzsData['level'] ?? 0;
|
||||
|
||||
// // 根据level值确定显示内容和颜色
|
||||
// String levelText = '';
|
||||
// Color levelColor = themeController.currentColor.sc3;
|
||||
|
||||
// switch (level) {
|
||||
// case 0:
|
||||
// levelText = '正常';
|
||||
// levelColor = Colors.green;
|
||||
// break;
|
||||
// case 1:
|
||||
// levelText = '轻度疲劳';
|
||||
// levelColor = Colors.orange;
|
||||
// break;
|
||||
// case 2:
|
||||
// levelText = '中度疲劳';
|
||||
// levelColor = Colors.red;
|
||||
// break;
|
||||
// case 3:
|
||||
// levelText = '重度疲劳';
|
||||
// levelColor = Colors.red;
|
||||
// break;
|
||||
// default:
|
||||
// levelText = '未知';
|
||||
// levelColor = Colors.grey;
|
||||
// }
|
||||
|
||||
// // 构建StatusBarWithIndicator需要的数据格式
|
||||
// List<Map<String, dynamic>> showLabel = [
|
||||
// {
|
||||
// 'key': 0,
|
||||
// 'name': '正常',
|
||||
// 'color': Colors.green,
|
||||
// },
|
||||
// {
|
||||
// 'key': 1,
|
||||
// 'name': '轻度疲劳',
|
||||
// 'color': Colors.orange,
|
||||
// },
|
||||
// {
|
||||
// 'key': 2,
|
||||
// 'name': '中度疲劳',
|
||||
// 'color': Colors.red,
|
||||
// },
|
||||
// {
|
||||
// 'key': 3,
|
||||
// 'name': '重度疲劳',
|
||||
// 'color': Colors.red,
|
||||
// },
|
||||
// ];
|
||||
|
||||
// return Container(
|
||||
// width: double.infinity,
|
||||
// decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5,
|
||||
// borderRadius:
|
||||
// BorderRadius.circular(AppConstants().normal_container_radius),
|
||||
// ),
|
||||
// child: Padding(
|
||||
// padding:
|
||||
// EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Container(
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// "疲劳指数".tr,
|
||||
// style: TextStyle(
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontSize: AppConstants().title_text_fontSize),
|
||||
// maxLines: 1,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// ),
|
||||
// ),
|
||||
// ClickableContainer(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor: Colors.white,
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(
|
||||
// 14.rpx, 10.rpx, 14.rpx, 10.rpx),
|
||||
// borderRadius: 0.rpx,
|
||||
// onTap: () {
|
||||
// if (AppConstants().ent_type ==
|
||||
// APPPackageType.MHT.code) {
|
||||
// showTipDialog(
|
||||
// context,
|
||||
// Container(
|
||||
// child: Text(
|
||||
// "疲劳指数是评估人体疲劳程度的重要指标,反映身体和精神状态的疲劳水平。".tr,
|
||||
// style: TextStyle(
|
||||
// fontSize: 26.rpx,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor: Color(0xFFFFFFFF),
|
||||
// colors: [
|
||||
// Color(0XFF1592AA),
|
||||
// Color(0xFF0C83A7),
|
||||
// Color(0xFF006FA3)
|
||||
// ],
|
||||
// );
|
||||
// } else {
|
||||
// showTipDialog(
|
||||
// context,
|
||||
// Container(
|
||||
// child: Text(
|
||||
// "疲劳指数是评估人体疲劳程度的重要指标,反映身体和精神状态的疲劳水平。".tr,
|
||||
// style: TextStyle(
|
||||
// fontSize: 26.rpx,
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor: themeController.currentColor.sc17,
|
||||
// colors: AppConstants().thNormalButton,
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// child: Container(
|
||||
// padding:
|
||||
// EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0.rpx, 0),
|
||||
// width: 28.rpx,
|
||||
// height: 28.rpx,
|
||||
// child: SvgPicture.asset(
|
||||
// 'assets/img/icon/explain.svg',
|
||||
// fit: BoxFit.cover,
|
||||
// color: themeController.currentColor.sc4,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 83.rpx,
|
||||
// ),
|
||||
// // 显示level值的文本
|
||||
// // Padding(
|
||||
// // padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 30.rpx),
|
||||
// // child: Row(
|
||||
// // mainAxisAlignment: MainAxisAlignment.center,
|
||||
// // children: [
|
||||
// // Text(
|
||||
// // '当前状态:',
|
||||
// // style: TextStyle(
|
||||
// // fontSize: 30.rpx,
|
||||
// // color: themeController.currentColor.sc4,
|
||||
// // ),
|
||||
// // ),
|
||||
// // Text(
|
||||
// // levelText,
|
||||
// // style: TextStyle(
|
||||
// // fontSize: 36.rpx,
|
||||
// // fontWeight: FontWeight.bold,
|
||||
// // color: levelColor,
|
||||
// // ),
|
||||
// // ),
|
||||
// // ],
|
||||
// // ),
|
||||
// // ),
|
||||
// Padding(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(
|
||||
// 30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
// child: StatusBarWithIndicator(
|
||||
// selectKey: level, // 使用level值作为选中的key
|
||||
// showLabel: showLabel,
|
||||
// currentValueText: "当前属于".tr,
|
||||
// showCurrentValue: true,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 56.rpx,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// } catch (e) {
|
||||
// es.EasyDartModule.logger.error("疲劳指数绘制异常${e}");
|
||||
// return Container();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
@@ -34,6 +274,24 @@ class _PiLaoZhiShuPercentWidgetState extends State<QcPiLaoZhiShuPercentWidget> {
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// 辅助方法:将颜色字符串转换为Color对象
|
||||
Color _getColorFromString(String colorStr) {
|
||||
try {
|
||||
// 如果颜色字符串以#开头,直接使用
|
||||
if (colorStr.startsWith('#')) {
|
||||
return Color(int.parse('0xFF${colorStr.substring(1)}'));
|
||||
}
|
||||
// 如果是6位十六进制颜色码(不带#)
|
||||
else if (colorStr.length == 6) {
|
||||
return Color(int.parse('0xFF$colorStr'));
|
||||
}
|
||||
} catch (e) {
|
||||
es.EasyDartModule.logger.error("颜色转换异常:$e");
|
||||
}
|
||||
// 默认返回主题色
|
||||
return themeController.currentColor.sc3;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -49,56 +307,52 @@ class _PiLaoZhiShuPercentWidgetState extends State<QcPiLaoZhiShuPercentWidget> {
|
||||
}
|
||||
|
||||
int level = plzsData['level'] ?? 0;
|
||||
|
||||
// 根据level值确定显示内容和颜色
|
||||
String levelText = '';
|
||||
Color levelColor = themeController.currentColor.sc3;
|
||||
|
||||
switch (level) {
|
||||
case 0:
|
||||
levelText = '正常';
|
||||
levelColor = Colors.green;
|
||||
break;
|
||||
case 1:
|
||||
levelText = '轻度疲劳';
|
||||
levelColor = Colors.orange;
|
||||
break;
|
||||
case 2:
|
||||
levelText = '中度疲劳';
|
||||
levelColor = Colors.red;
|
||||
break;
|
||||
case 3:
|
||||
levelText = '重度疲劳';
|
||||
levelColor = Colors.red;
|
||||
break;
|
||||
default:
|
||||
levelText = '未知';
|
||||
levelColor = Colors.grey;
|
||||
}
|
||||
|
||||
|
||||
// 从reportData中获取type和zs数据
|
||||
Map<String, dynamic> typeData = widget.reportData['type'] ?? {};
|
||||
List<dynamic> zsList = typeData['zs'] ?? [];
|
||||
|
||||
// 构建StatusBarWithIndicator需要的数据格式
|
||||
List<Map<String, dynamic>> showLabel = [
|
||||
{
|
||||
'key': 0,
|
||||
'name': '正常',
|
||||
'color': Colors.green,
|
||||
},
|
||||
{
|
||||
'key': 1,
|
||||
'name': '轻度疲劳',
|
||||
'color': Colors.orange,
|
||||
},
|
||||
{
|
||||
'key': 2,
|
||||
'name': '中度疲劳',
|
||||
'color': Colors.red,
|
||||
},
|
||||
{
|
||||
'key': 3,
|
||||
'name': '重度疲劳',
|
||||
'color': Colors.red,
|
||||
},
|
||||
];
|
||||
List<Map<String, dynamic>> showLabel = [];
|
||||
|
||||
if (zsList.isNotEmpty) {
|
||||
// 从zs数据动态构建showLabel
|
||||
showLabel = zsList.map((item) {
|
||||
return {
|
||||
'key': item['level'] ?? 0,
|
||||
'name': item['name'] ?? '未知',
|
||||
'color': _getColorFromString(item['color'] ?? ''),
|
||||
};
|
||||
}).toList();
|
||||
|
||||
// 按level排序,确保顺序正确
|
||||
showLabel.sort((a, b) => (a['key'] as int).compareTo(b['key'] as int));
|
||||
} else {
|
||||
// 如果zs数据为空,使用默认数据作为后备方案
|
||||
es.EasyDartModule.logger.warning("zs数据为空,使用默认配置");
|
||||
showLabel = [
|
||||
{
|
||||
'key': 0,
|
||||
'name': '正常',
|
||||
'color': Colors.green,
|
||||
},
|
||||
{
|
||||
'key': 1,
|
||||
'name': '轻度疲劳',
|
||||
'color': Colors.orange,
|
||||
},
|
||||
{
|
||||
'key': 2,
|
||||
'name': '中度疲劳',
|
||||
'color': Colors.red,
|
||||
},
|
||||
{
|
||||
'key': 3,
|
||||
'name': '重度疲劳',
|
||||
'color': Colors.red,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
@@ -189,30 +443,6 @@ class _PiLaoZhiShuPercentWidgetState extends State<QcPiLaoZhiShuPercentWidget> {
|
||||
SizedBox(
|
||||
height: 83.rpx,
|
||||
),
|
||||
// 显示level值的文本
|
||||
// Padding(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 30.rpx),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Text(
|
||||
// '当前状态:',
|
||||
// style: TextStyle(
|
||||
// fontSize: 30.rpx,
|
||||
// color: themeController.currentColor.sc4,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// levelText,
|
||||
// style: TextStyle(
|
||||
// fontSize: 36.rpx,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// color: levelColor,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
@@ -235,4 +465,4 @@ class _PiLaoZhiShuPercentWidgetState extends State<QcPiLaoZhiShuPercentWidget> {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,246 @@
|
||||
// import 'package:ef/ef.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_svg/svg.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/tool/ClickableContainer.dart';
|
||||
// import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||
// import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
// import 'package:vbvs_app/pages/sleep_report/chart/StatusBarWithIndicator.dart';
|
||||
// import 'package:EasyDartModule/EasyDartModule.dart' as es;
|
||||
|
||||
// class QcZiZhuShenJingPercentWidget extends StatefulWidget {
|
||||
// var reportData; // 改为更通用的名称
|
||||
// QcZiZhuShenJingPercentWidget({super.key, required this.reportData});
|
||||
|
||||
// @override
|
||||
// State<QcZiZhuShenJingPercentWidget> createState() =>
|
||||
// _ZiZhuShenJingPercentWidgetState();
|
||||
// }
|
||||
|
||||
// class _ZiZhuShenJingPercentWidgetState
|
||||
// extends State<QcZiZhuShenJingPercentWidget> {
|
||||
// @override
|
||||
// void setState(VoidCallback callback) {
|
||||
// super.setState(callback);
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void dispose() {
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// try {
|
||||
// if (widget.reportData == null) {
|
||||
// return Container();
|
||||
// }
|
||||
|
||||
// // 从reportData中获取zzsjphzs数据
|
||||
// Map<String, dynamic> zzsjphzsData = widget.reportData['zzsjphzs'] ?? {};
|
||||
// if (zzsjphzsData.isEmpty) {
|
||||
// return Container();
|
||||
// }
|
||||
|
||||
// int level = zzsjphzsData['level'] ?? 0;
|
||||
|
||||
// // 根据level值确定显示内容和颜色
|
||||
// String levelText = '';
|
||||
// Color levelColor = themeController.currentColor.sc3;
|
||||
|
||||
// switch (level) {
|
||||
// case 0:
|
||||
// levelText = '正常';
|
||||
// levelColor = Colors.green;
|
||||
// break;
|
||||
// case 1:
|
||||
// levelText = '轻度失衡';
|
||||
// levelColor = Colors.orange;
|
||||
// break;
|
||||
// case 2:
|
||||
// levelText = '中度失衡';
|
||||
// levelColor = Colors.red;
|
||||
// break;
|
||||
// case 3:
|
||||
// levelText = '重度失衡';
|
||||
// levelColor = Colors.red;
|
||||
// break;
|
||||
// default:
|
||||
// levelText = '未知';
|
||||
// levelColor = Colors.grey;
|
||||
// }
|
||||
|
||||
// // 构建StatusBarWithIndicator需要的数据格式
|
||||
// List<Map<String, dynamic>> showLabel = [
|
||||
// {
|
||||
// 'key': 0,
|
||||
// 'name': '正常',
|
||||
// 'color': Colors.green,
|
||||
// },
|
||||
// {
|
||||
// 'key': 1,
|
||||
// 'name': '轻度失衡',
|
||||
// 'color': Colors.orange,
|
||||
// },
|
||||
// {
|
||||
// 'key': 2,
|
||||
// 'name': '中度失衡',
|
||||
// 'color': Colors.red,
|
||||
// },
|
||||
// {
|
||||
// 'key': 3,
|
||||
// 'name': '重度失衡',
|
||||
// 'color': Colors.red,
|
||||
// },
|
||||
// ];
|
||||
|
||||
// return Container(
|
||||
// width: double.infinity,
|
||||
// decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5,
|
||||
// borderRadius: BorderRadius.circular(
|
||||
// AppConstants().normal_container_radius), // 你可以按需调整圆角半径
|
||||
// ),
|
||||
// child: Padding(
|
||||
// padding:
|
||||
// EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Container(
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// "自主神经平衡指数".tr,
|
||||
// style: TextStyle(
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontSize: AppConstants().title_text_fontSize),
|
||||
// maxLines: 1,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// ),
|
||||
// ),
|
||||
// ClickableContainer(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor: Colors.white, // 或设置为你需要的水波纹颜色
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(
|
||||
// 14.rpx, 10.rpx, 14.rpx, 10.rpx), //
|
||||
// borderRadius: 0.rpx, // 圆形点击区域
|
||||
// onTap: () {
|
||||
// if (AppConstants().ent_type ==
|
||||
// APPPackageType.MHT.code) {
|
||||
// showTipDialog(
|
||||
// context,
|
||||
// Container(
|
||||
// child: Text(
|
||||
// // "心理健康评估介绍".tr,
|
||||
// "自主神经平衡指数 是评估人体自主神经系统(ANS)功能状态的重要指标,主要反映交感神经和副交感神经的活性平衡关系。"
|
||||
// .tr,
|
||||
// style: TextStyle(
|
||||
// fontSize: 26.rpx,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor: Color(0xFFFFFFFF),
|
||||
// colors: [
|
||||
// Color(0XFF1592AA),
|
||||
// Color(0xFF0C83A7),
|
||||
// Color(0xFF006FA3)
|
||||
// ],
|
||||
// );
|
||||
// } else {
|
||||
// showTipDialog(
|
||||
// context,
|
||||
// Container(
|
||||
// child: Text(
|
||||
// "自主神经平衡指数 是评估人体自主神经系统(ANS)功能状态的重要指标,主要反映交感神经和副交感神经的活性平衡关系。"
|
||||
// .tr,
|
||||
// style: TextStyle(
|
||||
// fontSize: 26.rpx,
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor: themeController.currentColor.sc17,
|
||||
// colors: AppConstants().thNormalButton,
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// child: Container(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(
|
||||
// 0, 0.rpx, 0.rpx, 0), // 外部 padding 移到内部
|
||||
// width: 28.rpx,
|
||||
// height: 28.rpx,
|
||||
// child: SvgPicture.asset(
|
||||
// 'assets/img/icon/explain.svg',
|
||||
// fit: BoxFit.cover,
|
||||
// color: themeController.currentColor.sc4,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 83.rpx,
|
||||
// ),
|
||||
// // 显示level值的文本
|
||||
// // Padding(
|
||||
// // padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 30.rpx),
|
||||
// // child: Row(
|
||||
// // mainAxisAlignment: MainAxisAlignment.center,
|
||||
// // children: [
|
||||
// // Text(
|
||||
// // '当前状态:',
|
||||
// // style: TextStyle(
|
||||
// // fontSize: 30.rpx,
|
||||
// // color: themeController.currentColor.sc4,
|
||||
// // ),
|
||||
// // ),
|
||||
// // Text(
|
||||
// // levelText,
|
||||
// // style: TextStyle(
|
||||
// // fontSize: 36.rpx,
|
||||
// // fontWeight: FontWeight.bold,
|
||||
// // color: levelColor,
|
||||
// // ),
|
||||
// // ),
|
||||
// // ],
|
||||
// // ),
|
||||
// // ),
|
||||
// Padding(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(
|
||||
// 30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
// child: StatusBarWithIndicator(
|
||||
// selectKey: level, // 使用level值作为选中的key
|
||||
// showLabel: showLabel,
|
||||
// currentValueText: "当前属于".tr,
|
||||
// showCurrentValue: true,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 56.rpx,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// } catch (e) {
|
||||
// es.EasyDartModule.logger.error("自主神经平衡指数绘制异常${e}");
|
||||
// return Container();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
@@ -36,6 +279,24 @@ class _ZiZhuShenJingPercentWidgetState
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// 辅助方法:将颜色字符串转换为Color对象
|
||||
Color _getColorFromString(String colorStr) {
|
||||
try {
|
||||
// 如果颜色字符串以#开头,直接使用
|
||||
if (colorStr.startsWith('#')) {
|
||||
return Color(int.parse('0xFF${colorStr.substring(1)}'));
|
||||
}
|
||||
// 如果是6位十六进制颜色码(不带#)
|
||||
else if (colorStr.length == 6) {
|
||||
return Color(int.parse('0xFF$colorStr'));
|
||||
}
|
||||
} catch (e) {
|
||||
es.EasyDartModule.logger.error("颜色转换异常:$e");
|
||||
}
|
||||
// 默认返回主题色
|
||||
return themeController.currentColor.sc3;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
try {
|
||||
@@ -51,55 +312,51 @@ class _ZiZhuShenJingPercentWidgetState
|
||||
|
||||
int level = zzsjphzsData['level'] ?? 0;
|
||||
|
||||
// 根据level值确定显示内容和颜色
|
||||
String levelText = '';
|
||||
Color levelColor = themeController.currentColor.sc3;
|
||||
|
||||
switch (level) {
|
||||
case 0:
|
||||
levelText = '正常';
|
||||
levelColor = Colors.green;
|
||||
break;
|
||||
case 1:
|
||||
levelText = '轻度失衡';
|
||||
levelColor = Colors.orange;
|
||||
break;
|
||||
case 2:
|
||||
levelText = '中度失衡';
|
||||
levelColor = Colors.red;
|
||||
break;
|
||||
case 3:
|
||||
levelText = '重度失衡';
|
||||
levelColor = Colors.red;
|
||||
break;
|
||||
default:
|
||||
levelText = '未知';
|
||||
levelColor = Colors.grey;
|
||||
}
|
||||
// 从reportData中获取type和zs数据
|
||||
Map<String, dynamic> typeData = widget.reportData['type'] ?? {};
|
||||
List<dynamic> zsList = typeData['zs'] ?? [];
|
||||
|
||||
// 构建StatusBarWithIndicator需要的数据格式
|
||||
List<Map<String, dynamic>> showLabel = [
|
||||
{
|
||||
'key': 0,
|
||||
'name': '正常',
|
||||
'color': Colors.green,
|
||||
},
|
||||
{
|
||||
'key': 1,
|
||||
'name': '轻度失衡',
|
||||
'color': Colors.orange,
|
||||
},
|
||||
{
|
||||
'key': 2,
|
||||
'name': '中度失衡',
|
||||
'color': Colors.red,
|
||||
},
|
||||
{
|
||||
'key': 3,
|
||||
'name': '重度失衡',
|
||||
'color': Colors.red,
|
||||
},
|
||||
];
|
||||
List<Map<String, dynamic>> showLabel = [];
|
||||
|
||||
if (zsList.isNotEmpty) {
|
||||
// 从zs数据动态构建showLabel
|
||||
showLabel = zsList.map((item) {
|
||||
return {
|
||||
'key': item['level'] ?? 0,
|
||||
'name': item['name'] ?? '未知',
|
||||
'color': _getColorFromString(item['color'] ?? ''),
|
||||
};
|
||||
}).toList();
|
||||
|
||||
// 按level排序,确保顺序正确
|
||||
showLabel.sort((a, b) => (a['key'] as int).compareTo(b['key'] as int));
|
||||
} else {
|
||||
// 如果zs数据为空,使用默认数据作为后备方案
|
||||
es.EasyDartModule.logger.warning("自主神经平衡指数zs数据为空,使用默认配置");
|
||||
showLabel = [
|
||||
{
|
||||
'key': 0,
|
||||
'name': '正常',
|
||||
'color': Colors.green,
|
||||
},
|
||||
{
|
||||
'key': 1,
|
||||
'name': '轻度失衡',
|
||||
'color': Colors.orange,
|
||||
},
|
||||
{
|
||||
'key': 2,
|
||||
'name': '中度失衡',
|
||||
'color': Colors.red,
|
||||
},
|
||||
{
|
||||
'key': 3,
|
||||
'name': '重度失衡',
|
||||
'color': Colors.red,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
@@ -193,30 +450,6 @@ class _ZiZhuShenJingPercentWidgetState
|
||||
SizedBox(
|
||||
height: 83.rpx,
|
||||
),
|
||||
// 显示level值的文本
|
||||
// Padding(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 30.rpx),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Text(
|
||||
// '当前状态:',
|
||||
// style: TextStyle(
|
||||
// fontSize: 30.rpx,
|
||||
// color: themeController.currentColor.sc4,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// levelText,
|
||||
// style: TextStyle(
|
||||
// fontSize: 36.rpx,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// color: levelColor,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
|
||||
@@ -3,6 +3,7 @@ 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';
|
||||
@@ -50,21 +51,50 @@ class _QcHeartPointWidgetState extends State<QcHeartPointWidget> {
|
||||
|
||||
double maxX = 0;
|
||||
double maxY = 0;
|
||||
double minX = double.infinity; // 初始化为无穷大
|
||||
double minY = double.infinity; // 初始化为无穷大
|
||||
|
||||
List<ScatterSpot> data = [];
|
||||
|
||||
// try {
|
||||
// data = hrsData.map<ScatterSpot>((item) {
|
||||
// double x = (item['x'] ?? 0).toDouble(); // 注意这里从x取值
|
||||
// double y = (item['y'] ?? 0).toDouble(); // 注意这里从y取值
|
||||
// if (x > maxX) maxX = x;
|
||||
// if (y > maxY) maxY = y;
|
||||
// return ScatterSpot(x, y);
|
||||
// }).toList();
|
||||
// } catch (e) {
|
||||
// print(e);
|
||||
// }
|
||||
|
||||
try {
|
||||
data = hrsData.map<ScatterSpot>((item) {
|
||||
double x = (item['x'] ?? 0).toDouble(); // 注意这里从x取值
|
||||
double y = (item['y'] ?? 0).toDouble(); // 注意这里从y取值
|
||||
double x = (item['x'] ?? 0).toDouble();
|
||||
double y = (item['y'] ?? 0).toDouble();
|
||||
|
||||
// 更新最大值
|
||||
if (x > maxX) maxX = x;
|
||||
if (y > maxY) maxY = y;
|
||||
|
||||
// 更新最小值
|
||||
if (x < minX) minX = x;
|
||||
if (y < minY) minY = y;
|
||||
|
||||
return ScatterSpot(x, y);
|
||||
}).toList();
|
||||
|
||||
// 如果没有数据,将minX和minY设为0
|
||||
if (data.isEmpty) {
|
||||
minX = 0;
|
||||
minY = 0;
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
// 发生异常时,将minX和minY设为0
|
||||
minX = 0;
|
||||
minY = 0;
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
@@ -124,15 +154,34 @@ class _QcHeartPointWidgetState extends State<QcHeartPointWidget> {
|
||||
} else {
|
||||
showTipDialog(
|
||||
context,
|
||||
Container(
|
||||
child: Text(
|
||||
"心电散点图是用非线性的图形方法描记的连续心冲击图的RR间期图,因图形由散点组成,又称散点图。"
|
||||
.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: themeController.currentColor.sc3,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
"心电散点图是用非线性的图形方法描记的连续心冲击图的RR间期图,因图形由散点组成,又称散点图。"
|
||||
.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.rpx,
|
||||
),
|
||||
Container(
|
||||
// color: Colors.red,
|
||||
width: MediaQuery.of(context)
|
||||
.size
|
||||
.width, // 宽度为屏幕宽度
|
||||
// height: 200.rpx,
|
||||
child: Image.asset(
|
||||
'assets/img/heartpointEx.png', // 请根据实际图片路径修改
|
||||
fit: BoxFit.cover, // 图片填充方式,可以根据需要调整
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
colors: AppConstants().thNormalButton,
|
||||
@@ -172,6 +221,8 @@ class _QcHeartPointWidgetState extends State<QcHeartPointWidget> {
|
||||
// 根据实际数据动态设置最大最小值
|
||||
xMax: maxX > 0 ? maxX.toInt() + 100 : 3000,
|
||||
yMax: maxY > 0 ? maxY.toInt() + 100 : 3000,
|
||||
// xMin: minX > 0 ? minX.toInt() - 100 : 0,
|
||||
// yMin: minY > 0 ? minY.toInt() - 100 : 0,
|
||||
xMin: 0,
|
||||
yMin: 0,
|
||||
pointColor: stringToColor("#00C1AA"), // 点的颜色
|
||||
@@ -182,135 +233,6 @@ class _QcHeartPointWidgetState extends State<QcHeartPointWidget> {
|
||||
SizedBox(
|
||||
height: 31.rpx,
|
||||
),
|
||||
// Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "图形参考".tr,
|
||||
// style: TextStyle(
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontSize: AppConstants().middler_text_fontSize),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 31.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/heartPic4.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)),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user