You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
271 lines
13 KiB
Dart
271 lines
13 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:vital_sign_camera/vital_sign_camera.dart';
|
|
|
|
import 'components/vital_sign_widget.dart';
|
|
|
|
class ResultScreen extends StatelessWidget {
|
|
final Health? healthResult;
|
|
|
|
late final VitalSign? _vitalSign;
|
|
late final HolisticAnalysis? _holisticAnalysis;
|
|
late final CardiovascularRisks? _cardiovascularRisks;
|
|
late final CovidRisk? _covidRisk;
|
|
late final ScanParameters? _scanParameters;
|
|
|
|
ResultScreen({
|
|
Key? key,
|
|
required this.healthResult,
|
|
}) : super(key: key) {
|
|
_vitalSign = healthResult?.vitalSigns;
|
|
_holisticAnalysis = healthResult?.holisticHealth;
|
|
_cardiovascularRisks = healthResult?.risks?.cardiovascularRisks;
|
|
_covidRisk = healthResult?.risks?.covidRisk;
|
|
_scanParameters = healthResult?.scanParameters;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final deviceSize = MediaQuery.of(context).size;
|
|
const textColor = Color.fromARGB(255, 0, 0, 0);
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Result'),
|
|
),
|
|
body: SingleChildScrollView(
|
|
child: Center(
|
|
child: SizedBox(
|
|
width: deviceSize.width * 0.9,
|
|
child: Container(
|
|
color: const Color.fromARGB(0, 255, 255, 255),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(15),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
margin: const EdgeInsets.fromLTRB(0, 0, 0, 10),
|
|
child: const Text(
|
|
"Vital Signs",
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
color: Colors.amber,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Heart Rate",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.vitalSigns.heartRate)),
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "SPO2",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.vitalSigns.spo2)),
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "IBI",
|
|
vitalSignValue:
|
|
formatValueToTwoDp(healthResult?.vitalSigns.ibi)),
|
|
if (_vitalSign?.stress != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Stress",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.vitalSigns.stress)),
|
|
if (_vitalSign?.respiratoryRate != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Respiratory Rate",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.vitalSigns.respiratoryRate)),
|
|
if (_vitalSign?.hrvRmssd != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "HRV RMSSD",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.vitalSigns.hrvRmssd)),
|
|
if (_vitalSign?.hrvSdnn != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "HRV SDNN",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.vitalSigns.hrvSdnn)),
|
|
if (_vitalSign?.temperature != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Temperature",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.vitalSigns.temperature)),
|
|
if (_vitalSign?.bloodPressure != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Blood Pressure",
|
|
vitalSignValue:
|
|
healthResult?.vitalSigns.bloodPressure ?? ""),
|
|
if (_vitalSign?.bloodPressureSystolic != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Blood Pressure Systolic",
|
|
vitalSignValue: formatValueToTwoDp(healthResult
|
|
?.vitalSigns.bloodPressureSystolic)),
|
|
if (_vitalSign?.bloodPressureDiastolic != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Blood Pressure Diastolic",
|
|
vitalSignValue: formatValueToTwoDp(healthResult
|
|
?.vitalSigns.bloodPressureDiastolic)),
|
|
if (_holisticAnalysis != null)
|
|
Container(
|
|
margin: const EdgeInsets.fromLTRB(0, 25, 0, 10),
|
|
child: const Text(
|
|
"Holistic Analysis",
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
color: Colors.amber,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
if (_holisticAnalysis != null &&
|
|
_holisticAnalysis?.bmi != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "BMI",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.holisticHealth?.bmi)),
|
|
if (_holisticAnalysis != null &&
|
|
_holisticAnalysis?.generalWellness != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "General Wellness",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.holisticHealth?.generalWellness)),
|
|
if (_holisticAnalysis != null &&
|
|
_holisticAnalysis?.absi != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "ABSI",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.holisticHealth?.absi)),
|
|
if (_holisticAnalysis != null &&
|
|
_holisticAnalysis?.cardiacWorkload != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Cardiac Workload",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.holisticHealth?.cardiacWorkload)),
|
|
if (_holisticAnalysis != null &&
|
|
_holisticAnalysis?.pulseRespiratoryQuotient != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Pulse Respiratory Quotient",
|
|
vitalSignValue: formatValueToTwoDp(healthResult
|
|
?.holisticHealth?.pulseRespiratoryQuotient)),
|
|
if (_holisticAnalysis != null &&
|
|
_holisticAnalysis?.waistToHeightRatio != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Waist to Height Ratio",
|
|
vitalSignValue: formatValueToTwoDp(healthResult
|
|
?.holisticHealth?.waistToHeightRatio)),
|
|
if (_cardiovascularRisks != null)
|
|
Container(
|
|
margin: const EdgeInsets.fromLTRB(0, 25, 0, 10),
|
|
child: const Text(
|
|
"Cardiovascular Risks",
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
color: Colors.amber,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
if (_cardiovascularRisks != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "General",
|
|
vitalSignValue: formatValueToTwoDp(healthResult
|
|
?.risks?.cardiovascularRisks?.generalRisk)),
|
|
if (_cardiovascularRisks != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Congestive Heart Failure",
|
|
vitalSignValue: formatValueToTwoDp(healthResult
|
|
?.risks
|
|
?.cardiovascularRisks
|
|
?.congestiveHeartFailure)),
|
|
if (_cardiovascularRisks != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Coronary Heart Disease",
|
|
vitalSignValue: formatValueToTwoDp(healthResult
|
|
?.risks
|
|
?.cardiovascularRisks
|
|
?.coronaryHeartDisease)),
|
|
if (_cardiovascularRisks != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Intermittent Claudication",
|
|
vitalSignValue: formatValueToTwoDp(healthResult
|
|
?.risks
|
|
?.cardiovascularRisks
|
|
?.intermittentClaudication)),
|
|
if (_cardiovascularRisks != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Stroke",
|
|
vitalSignValue: formatValueToTwoDp(healthResult
|
|
?.risks?.cardiovascularRisks?.stroke)),
|
|
if (_covidRisk != null)
|
|
Container(
|
|
margin: const EdgeInsets.fromLTRB(0, 25, 0, 10),
|
|
child: const Text(
|
|
"Covid Risks",
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
color: Colors.amber,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
if (_covidRisk != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Risk",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.risks?.covidRisk?.covidRisk)),
|
|
if (_scanParameters != null)
|
|
Container(
|
|
margin: const EdgeInsets.fromLTRB(0, 25, 0, 10),
|
|
child: const Text(
|
|
"Scan Parameters",
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
color: Colors.amber,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
if (_scanParameters != null)
|
|
VitalSignWidget(
|
|
textColor: textColor,
|
|
vitalSignName: "Signal Quality",
|
|
vitalSignValue: formatValueToTwoDp(
|
|
healthResult?.scanParameters?.signalQuality)),
|
|
]),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
String formatValueToTwoDp(double? value) {
|
|
return (value != null) ? value.toStringAsFixed(2) : "";
|
|
}
|
|
}
|