更新快检功能必传mac参数
This commit is contained in:
@@ -124,3 +124,138 @@ class ScatterPlotChart extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// import 'dart:math' as math;
|
||||
|
||||
// import 'package:fl_chart/fl_chart.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
// import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
|
||||
// class ScatterPlotChart extends StatelessWidget {
|
||||
// final List<ScatterSpot> points;
|
||||
// final double xMin;
|
||||
// final double xMax;
|
||||
// final double yMin;
|
||||
// final double yMax;
|
||||
// final Color pointColor;
|
||||
|
||||
// ScatterPlotChart({
|
||||
// required this.points,
|
||||
// required this.xMin,
|
||||
// required this.xMax,
|
||||
// required this.yMin,
|
||||
// required this.yMax,
|
||||
// required this.pointColor,
|
||||
// });
|
||||
|
||||
// // 计算固定6格的间隔
|
||||
// double _calculateInterval(double min, double max) {
|
||||
// double range = max - min;
|
||||
// if (range <= 0) return 100; // 默认值
|
||||
|
||||
// // 固定分成6格
|
||||
// return range / 6;
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// double xInterval = _calculateInterval(xMin, xMax);
|
||||
// double yInterval = _calculateInterval(yMin, yMax);
|
||||
|
||||
// return SizedBox(
|
||||
// child: ScatterChart(
|
||||
// ScatterChartData(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// gridData: FlGridData(
|
||||
// show: true,
|
||||
// horizontalInterval: yInterval,
|
||||
// verticalInterval: xInterval,
|
||||
// getDrawingHorizontalLine: (value) {
|
||||
// return FlLine(
|
||||
// color: themeController.currentColor.sc4,
|
||||
// strokeWidth: 1.rpx,
|
||||
// dashArray: [5, 5], // 设置虚线 [实线长度, 空白长度]
|
||||
// );
|
||||
// },
|
||||
// getDrawingVerticalLine: (value) {
|
||||
// return FlLine(
|
||||
// color: themeController.currentColor.sc4,
|
||||
// strokeWidth: 1.rpx,
|
||||
// dashArray: [5, 5], // 设置虚线
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// titlesData: FlTitlesData(
|
||||
// show: true,
|
||||
// leftTitles: AxisTitles(
|
||||
// sideTitles: SideTitles(
|
||||
// showTitles: true,
|
||||
// reservedSize: 70.rpx,
|
||||
// interval: yInterval,
|
||||
// getTitlesWidget: (double value, TitleMeta meta) {
|
||||
// // 显示所有刻度值
|
||||
// return Padding(
|
||||
// padding: EdgeInsets.only(right: 14.rpx),
|
||||
// child: Text(
|
||||
// value.toStringAsFixed(0),
|
||||
// style: TextStyle(
|
||||
// fontSize: 18.rpx,
|
||||
// color: themeController.currentColor.sc4,
|
||||
// ),
|
||||
// maxLines: 1,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// textAlign: TextAlign.center,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// bottomTitles: AxisTitles(
|
||||
// sideTitles: SideTitles(
|
||||
// showTitles: true,
|
||||
// interval: xInterval,
|
||||
// getTitlesWidget: (double value, TitleMeta meta) {
|
||||
// return Text(
|
||||
// value.toStringAsFixed(0),
|
||||
// style: TextStyle(
|
||||
// fontSize: 18.rpx,
|
||||
// color: themeController.currentColor.sc4,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// rightTitles: AxisTitles(
|
||||
// sideTitles: SideTitles(showTitles: false),
|
||||
// ),
|
||||
// topTitles: AxisTitles(
|
||||
// sideTitles: SideTitles(showTitles: false),
|
||||
// ),
|
||||
// ),
|
||||
// borderData: FlBorderData(
|
||||
// show: true,
|
||||
// border: Border.all(
|
||||
// color: themeController.currentColor.sc4,
|
||||
// width: 0.5,
|
||||
// ),
|
||||
// ),
|
||||
// scatterSpots: points.map((point) {
|
||||
// return ScatterSpot(
|
||||
// point.x,
|
||||
// point.y,
|
||||
// dotPainter: FlDotCirclePainter(
|
||||
// radius: 3.rpx,
|
||||
// color: pointColor,
|
||||
// ),
|
||||
// );
|
||||
// }).toList(),
|
||||
// minX: xMin,
|
||||
// maxX: xMax,
|
||||
// minY: yMin,
|
||||
// maxY: yMax,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -393,6 +393,7 @@ class _HeartPointWidgetState extends State<HeartPointWidget> {
|
||||
),
|
||||
].divide(SizedBox(width: 20.rpx)),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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)),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||
import 'package:vbvs_app/component/tool/NewTopSlideNotification.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/date/CalendarController.dart';
|
||||
import 'package:vbvs_app/controller/sleep/sleep_report_controller.dart';
|
||||
@@ -71,348 +72,366 @@ class _QuickHealthReportPageState extends State<QuickHealthReportPage> {
|
||||
final healthLevelInfo = getHealthLevelInfo(widget.data);
|
||||
|
||||
double lineWidth = 150.rpx;
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
// onTap: () => FocusScope.of(context).unfocus(),,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: (widget.data['noBackImg'] != null &&
|
||||
widget.data['noBackImg'] == true)
|
||||
? null // ✅ 不要背景图
|
||||
: DecorationImage(
|
||||
image: (widget.data['backgroundImg'] != null &&
|
||||
widget.data['backgroundImg'].toString().isNotEmpty)
|
||||
? AssetImage(widget.data['backgroundImg'])
|
||||
: AssetImage(getBackgroundImageNoImage())
|
||||
as ImageProvider,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 背景透明
|
||||
appBar: (widget.data['arrow'] != null &&
|
||||
widget.data['arrow'] == false)
|
||||
? null
|
||||
: AppBar(
|
||||
backgroundColor: widget.data['backgroundColor'] != null
|
||||
? widget.data['backgroundColor'].withOpacity(0.8)
|
||||
: themeController.currentColor.sc5,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme:
|
||||
IconThemeData(color: themeController.currentColor.sc3),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'快检报告'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
try {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
// onTap: () => FocusScope.of(context).unfocus(),,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: (widget.data['noBackImg'] != null &&
|
||||
widget.data['noBackImg'] == true)
|
||||
? null // ✅ 不要背景图
|
||||
: DecorationImage(
|
||||
image: (widget.data['backgroundImg'] != null &&
|
||||
widget.data['backgroundImg']
|
||||
.toString()
|
||||
.isNotEmpty)
|
||||
? AssetImage(widget.data['backgroundImg'])
|
||||
: AssetImage(getBackgroundImageNoImage())
|
||||
as ImageProvider,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 背景透明
|
||||
appBar: (widget.data['arrow'] != null &&
|
||||
widget.data['arrow'] == false)
|
||||
? null
|
||||
: AppBar(
|
||||
backgroundColor: widget.data['backgroundColor'] != null
|
||||
? widget.data['backgroundColor'].withOpacity(0.8)
|
||||
: themeController.currentColor.sc5,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(
|
||||
color: themeController.currentColor.sc3),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'快检报告'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
/// 左边返回按钮
|
||||
if (widget.data['arrow'] == null ||
|
||||
widget.data['arrow'] == true)
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtomNew(),
|
||||
),
|
||||
],
|
||||
/// 左边返回按钮
|
||||
if (widget.data['arrow'] == null ||
|
||||
widget.data['arrow'] == true)
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtomNew(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Obx(() {
|
||||
try {
|
||||
var sleepReport = sleepReportController.sleepReport.value;
|
||||
if (sleepReport == null || sleepReport.isEmpty) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
30.rpx, 30.rpx, 30.rpx, 26.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 90.rpx, // 最小高度
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5, // 背景色
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Obx(() {
|
||||
try {
|
||||
var sleepReport = sleepReportController.sleepReport.value;
|
||||
if (sleepReport == null || sleepReport.isEmpty) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
30.rpx, 30.rpx, 30.rpx, 26.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 90.rpx, // 最小高度
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5, // 背景色
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
// 左侧图标
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 7.rpx),
|
||||
child: Icon(
|
||||
Icons.info_outline,
|
||||
size: 26.rpx,
|
||||
color:
|
||||
themeController.currentColor.sc8,
|
||||
),
|
||||
),
|
||||
|
||||
// 中间可换行文字
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin:
|
||||
EdgeInsets.only(right: 69.rpx),
|
||||
child: Text(
|
||||
'5分钟快速检测可能受到用户当前状态、过程中说话动作、精神紧张等情况影响,数据仅供参考。'
|
||||
.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.smaller_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc8,
|
||||
height: 1.4,
|
||||
),
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.fromLTRB(30.rpx, 0, 30.rpx, 0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc5,
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// 左侧图标
|
||||
// 第一个容器 - 包含Row布局
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 7.rpx),
|
||||
child: Icon(
|
||||
Icons.info_outline,
|
||||
size: 26.rpx,
|
||||
color: themeController.currentColor.sc8,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(30.rpx),
|
||||
decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5,
|
||||
borderRadius:
|
||||
BorderRadius.circular(16.rpx),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
// 左边的Column,包含五行文字
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${widget.data['person']['name']} (${widget.data['person']['gender']} ${widget.data['person']['age'].toInt()}岁)',
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.bigger_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
// fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 18.rpx),
|
||||
Text(
|
||||
"快检得分:".tr +
|
||||
'${widget.data['score']['score'].toInt()} 分',
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.small_an_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 18.rpx),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"健康等级:".tr,
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.small_an_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
healthLevelInfo['text'],
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.small_an_text_fontSize,
|
||||
color: healthLevelInfo[
|
||||
'color'],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 18.rpx),
|
||||
Text(
|
||||
"设备ID:".tr +
|
||||
'${widget.data['mac']}',
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.small_an_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 18.rpx),
|
||||
Text(
|
||||
"快检时间:".tr +
|
||||
'${MyUtils.timestampToDateString(widget.data['create_time'].toInt())}',
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.small_an_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// SizedBox(width: 20.rpx), // 左边文字和右边图片的间距
|
||||
|
||||
// 右边的本地图片
|
||||
Container(
|
||||
width: 120.rpx,
|
||||
height: 190.rpx,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(12.rpx),
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
'assets/img/black_body_still.png'), // 替换为您的本地图片路径
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// 中间可换行文字
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(right: 69.rpx),
|
||||
child: Text(
|
||||
'5分钟快速检测可能受到用户当前状态、过程中说话动作、精神紧张等情况影响,数据仅供参考。'
|
||||
.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.smaller_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc8,
|
||||
height: 1.4,
|
||||
),
|
||||
softWrap: true,
|
||||
SizedBox(height: 34.rpx), // 两个容器之间的间距
|
||||
|
||||
// 第二个容器 - 包含StatusBarWithIndicator todo接入报告数据
|
||||
Container(
|
||||
width: double.infinity,
|
||||
// height: 220.rpx,
|
||||
decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5,
|
||||
borderRadius:
|
||||
BorderRadius.circular(16.rpx),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 20.rpx, 30.rpx, 20.rpx),
|
||||
child: StatusBarWithIndicator(
|
||||
selectKey: widget.data['score']
|
||||
['level']
|
||||
.toInt(), // 这里传入对应的 level 值
|
||||
showLabel: (widget.data['type']
|
||||
['score'] as List)
|
||||
.map<Map<String, dynamic>>(
|
||||
(item) {
|
||||
return {
|
||||
'key': item['level']?.toInt() ??
|
||||
0, // 使用 level 作为 key
|
||||
'name': item['name'] ?? '',
|
||||
'color': stringToColor(
|
||||
item['color'] ??
|
||||
''), // 将颜色字符串转换为 Color
|
||||
'range':
|
||||
item['range'] ?? '', // 添加范围数据
|
||||
};
|
||||
}).toList(),
|
||||
showCurrentValue: true, // 显示当前值
|
||||
currentValueText:
|
||||
'当前属于'.tr, // 或者根据实际值动态生成
|
||||
showRange: true, // 显示范围
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 25.rpx), // 两个容器之间的间距
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(30.rpx, 0, 30.rpx, 0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc5,
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.fromLTRB(30.rpx, 0, 30.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
// padding: EdgeInsets.all(30.rpx),
|
||||
decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5,
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
),
|
||||
child: QcReportWidget(widget.data),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.fromLTRB(46.rpx, 0, 46.rpx, 0),
|
||||
child: Column(
|
||||
children: [
|
||||
// 第一个容器 - 包含Row布局
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(30.rpx),
|
||||
decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5,
|
||||
borderRadius:
|
||||
BorderRadius.circular(16.rpx),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
// 左边的Column,包含五行文字
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${widget.data['person']['name']} (${widget.data['person']['gender']} ${widget.data['person']['age'].toInt()}岁)',
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.bigger_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
// fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 18.rpx),
|
||||
Text(
|
||||
"快检得分:".tr +
|
||||
'${widget.data['score']['score'].toInt()} 分',
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.small_an_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 18.rpx),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"健康等级:".tr,
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.small_an_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
healthLevelInfo['text'],
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.small_an_text_fontSize,
|
||||
color: healthLevelInfo[
|
||||
'color'],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 18.rpx),
|
||||
Text(
|
||||
"设备ID:".tr +
|
||||
'${widget.data['mac']}',
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.small_an_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 18.rpx),
|
||||
Text(
|
||||
"快检时间:".tr +
|
||||
'${MyUtils.timestampToDateString(widget.data['create_time'].toInt())}',
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants()
|
||||
.small_an_text_fontSize,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// SizedBox(width: 20.rpx), // 左边文字和右边图片的间距
|
||||
|
||||
// 右边的本地图片
|
||||
Container(
|
||||
width: 120.rpx,
|
||||
height: 190.rpx,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(12.rpx),
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
'assets/img/black_body_still.png'), // 替换为您的本地图片路径
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
// Text(
|
||||
// "MAC号".tr +
|
||||
// ": ${widget.data['mac'] ?? '未知数据'.tr}",
|
||||
// style: TextStyle(
|
||||
// color: themeController.currentColor.sc4,
|
||||
// fontSize:
|
||||
// AppConstants().smaller_text_fontSize,
|
||||
// ),
|
||||
// ),
|
||||
SizedBox(
|
||||
height: 4.rpx,
|
||||
),
|
||||
Text(
|
||||
"注:本页报告是基于心率、呼吸等体征波形数据,通过AI算法模型分析完成,其结果仅供参考;其中报告未见数据异常部分,并不代表没有潜在性的疾病风险,如有不适请及时就医。"
|
||||
.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc4,
|
||||
fontSize:
|
||||
AppConstants().smaller_text_fontSize,
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 34.rpx), // 两个容器之间的间距
|
||||
|
||||
// 第二个容器 - 包含StatusBarWithIndicator todo接入报告数据
|
||||
Container(
|
||||
width: double.infinity,
|
||||
// height: 220.rpx,
|
||||
decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5,
|
||||
borderRadius:
|
||||
BorderRadius.circular(16.rpx),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 20.rpx, 30.rpx, 20.rpx),
|
||||
child: StatusBarWithIndicator(
|
||||
selectKey: widget.data['score']['level']
|
||||
.toInt(), // 这里传入对应的 level 值
|
||||
showLabel: (widget.data['type']['score']
|
||||
as List)
|
||||
.map<Map<String, dynamic>>((item) {
|
||||
return {
|
||||
'key': item['level']?.toInt() ??
|
||||
0, // 使用 level 作为 key
|
||||
'name': item['name'] ?? '',
|
||||
'color': stringToColor(
|
||||
item['color'] ??
|
||||
''), // 将颜色字符串转换为 Color
|
||||
'range':
|
||||
item['range'] ?? '', // 添加范围数据
|
||||
};
|
||||
}).toList(),
|
||||
showCurrentValue: true, // 显示当前值
|
||||
currentValueText:
|
||||
'当前属于'.tr, // 或者根据实际值动态生成
|
||||
showRange: true, // 显示范围
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 25.rpx), // 两个容器之间的间距
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(30.rpx, 0, 30.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
// padding: EdgeInsets.all(30.rpx),
|
||||
decoration: BoxDecoration(
|
||||
// color: themeController.currentColor.sc5,
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
),
|
||||
child: QcReportWidget(widget.data),
|
||||
SizedBox(
|
||||
height: 40.rpx,
|
||||
),
|
||||
),
|
||||
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().smaller_text_fontSize,
|
||||
// ),
|
||||
// ),
|
||||
SizedBox(
|
||||
height: 4.rpx,
|
||||
),
|
||||
Text(
|
||||
"注:本页报告是基于心率、呼吸等体征波形数据,通过AI算法模型分析完成,其结果仅供参考;其中报告未见数据异常部分,并不代表没有潜在性的疾病风险,如有不适请及时就医。"
|
||||
.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc4,
|
||||
fontSize:
|
||||
AppConstants().smaller_text_fontSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 40.rpx,
|
||||
),
|
||||
]
|
||||
.divide(SizedBox(
|
||||
height: 25.rpx,
|
||||
))
|
||||
.addToEnd(SizedBox(height: 25.rpx)),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
]
|
||||
.divide(SizedBox(
|
||||
height: 25.rpx,
|
||||
))
|
||||
.addToEnd(SizedBox(height: 25.rpx)),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
} catch (e, s) {
|
||||
ef.log('ERROR:$e$s');
|
||||
}
|
||||
} catch (e, s) {
|
||||
ef.log('ERROR:$e$s');
|
||||
}
|
||||
return NullDataWidget();
|
||||
}),
|
||||
return NullDataWidget();
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
} catch (e) {
|
||||
NewTopSlideNotification.show(
|
||||
text: '页面渲染失败:${e.toString()}'.tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> loadSleepReport(int type) async {
|
||||
|
||||
Reference in New Issue
Block a user