更新快检功能
This commit is contained in:
@@ -0,0 +1,242 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user