|
|
|
|
@ -1,7 +1,5 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/vital_signs/data/vitals_benchmark.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
|
|
|
|
|
@ -9,7 +7,9 @@ class VitalSignWidget extends StatelessWidget {
|
|
|
|
|
final String vitalSignName;
|
|
|
|
|
final String vitalSignValue;
|
|
|
|
|
final String vectorUrl;
|
|
|
|
|
final RangeConditionWithTitle condition;
|
|
|
|
|
final dynamic condition;
|
|
|
|
|
final Map<String, dynamic>? lookupValues;
|
|
|
|
|
final Map<String, dynamic>? bloodPressureValues;
|
|
|
|
|
final Color? textColor;
|
|
|
|
|
|
|
|
|
|
const VitalSignWidget({
|
|
|
|
|
@ -19,6 +19,8 @@ class VitalSignWidget extends StatelessWidget {
|
|
|
|
|
this.textColor,
|
|
|
|
|
required this.condition,
|
|
|
|
|
required this.vectorUrl,
|
|
|
|
|
this.lookupValues,
|
|
|
|
|
this.bloodPressureValues,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -70,10 +72,13 @@ class VitalSignWidget extends StatelessWidget {
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
Status(
|
|
|
|
|
if (lookupValues != null)
|
|
|
|
|
Status(
|
|
|
|
|
status:
|
|
|
|
|
"${TranslationBase.of(context).getValue(condition.current?.quantitativeInterpretation ?? '')}")
|
|
|
|
|
"${TranslationBase.of(context).getValue(condition.current?.quantitativeInterpretation ?? '')}",
|
|
|
|
|
originalData:
|
|
|
|
|
condition.current?.quantitativeInterpretation ?? '',
|
|
|
|
|
)
|
|
|
|
|
// Text(
|
|
|
|
|
// "${TranslationBase.of(context).getValue(condition.current?.quantitativeInterpretation ?? '')}",
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
@ -90,24 +95,95 @@ class VitalSignWidget extends StatelessWidget {
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 30,
|
|
|
|
|
// child: Row(mainAxisSize: MainAxisSize.max, children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
// flex: 1,
|
|
|
|
|
// child: ListView.separated(
|
|
|
|
|
// separatorBuilder: (_, __) => SizedBox(
|
|
|
|
|
// width: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// scrollDirection: Axis.horizontal,
|
|
|
|
|
// shrinkWrap: true,
|
|
|
|
|
// itemCount: condition.condition?.length ?? 0,
|
|
|
|
|
// itemBuilder: (_, index) => RangeWidget(
|
|
|
|
|
// title: condition.condition?[index].title ?? 'test',
|
|
|
|
|
// isSelected: condition.condition?[index]
|
|
|
|
|
// .isInRange(vitalSignValue) ==
|
|
|
|
|
// true,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ]),
|
|
|
|
|
if (lookupValues != null)
|
|
|
|
|
Flexible(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
separatorBuilder: (_, __) => SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: lookupValues?.length ?? 0,
|
|
|
|
|
itemBuilder: (_, index) {
|
|
|
|
|
var key = lookupValues?.keys.elementAt(index);
|
|
|
|
|
return RangeWidget(
|
|
|
|
|
title: key ?? '',
|
|
|
|
|
values: lookupValues?[key] ?? [],
|
|
|
|
|
isSelected: false,
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
if (bloodPressureValues != null)
|
|
|
|
|
Flexible(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
separatorBuilder: (_, __) => SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: bloodPressureValues?.length ?? 0,
|
|
|
|
|
itemBuilder: (_, index) {
|
|
|
|
|
var key = bloodPressureValues?.keys.elementAt(index);
|
|
|
|
|
print(
|
|
|
|
|
'the ssize is ${(bloodPressureValues?[key]?.length ?? 1) * 40} ');
|
|
|
|
|
// return RangeWidget(
|
|
|
|
|
// title: key??'',
|
|
|
|
|
// values: lookupValues?[key]??[],isSelected: false,
|
|
|
|
|
// );
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.getValue(key ?? ''),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.black, fontSize: 16),
|
|
|
|
|
),
|
|
|
|
|
Status(
|
|
|
|
|
status:
|
|
|
|
|
"${TranslationBase.of(context).getValue(condition.getValue(key)?.quantitativeInterpretation ?? '')}",
|
|
|
|
|
originalData: condition
|
|
|
|
|
.getValue(key)
|
|
|
|
|
?.quantitativeInterpretation ??
|
|
|
|
|
'',
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 220,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
separatorBuilder: (_, __) => SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount:
|
|
|
|
|
bloodPressureValues?[key]?.length ?? 0,
|
|
|
|
|
itemBuilder: (_, index) {
|
|
|
|
|
var title = bloodPressureValues?[key]
|
|
|
|
|
?.keys
|
|
|
|
|
.elementAt(index);
|
|
|
|
|
|
|
|
|
|
return RangeWidget(
|
|
|
|
|
title: title ?? '',
|
|
|
|
|
values: bloodPressureValues?[key]
|
|
|
|
|
?[title] ??
|
|
|
|
|
[],
|
|
|
|
|
isSelected: false,
|
|
|
|
|
);
|
|
|
|
|
}))
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
// ]),
|
|
|
|
|
// ),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
@ -146,43 +222,102 @@ class VitalSignWidget extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
class RangeWidget extends StatelessWidget {
|
|
|
|
|
final String title;
|
|
|
|
|
final List<String> values;
|
|
|
|
|
final bool isSelected;
|
|
|
|
|
|
|
|
|
|
const RangeWidget({super.key, required this.title, required this.isSelected});
|
|
|
|
|
const RangeWidget(
|
|
|
|
|
{super.key,
|
|
|
|
|
required this.title,
|
|
|
|
|
required this.isSelected,
|
|
|
|
|
required this.values});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
child: Material(
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(3),
|
|
|
|
|
),
|
|
|
|
|
// color: Color(0xFF359846),
|
|
|
|
|
color: (isSelected)
|
|
|
|
|
? CustomColors.accentColor
|
|
|
|
|
: CustomColors.lightGreyColor,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
title,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: (isSelected) ? Colors.white : Colors.black,
|
|
|
|
|
fontSize: 12),
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
child: Material(
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadiusDirectional.only(
|
|
|
|
|
topStart: Radius.circular(8),
|
|
|
|
|
bottomStart: Radius.circular(8),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// color: Color(0xFF359846),
|
|
|
|
|
color: CustomColors.lightGreyColor,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
top: 4.0, bottom: 4, right: 8, left: 8),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).getValue(title),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Material(
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadiusDirectional.only(
|
|
|
|
|
topEnd: Radius.circular(8),
|
|
|
|
|
bottomEnd: Radius.circular(8),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// color: Color(0xFF359846),
|
|
|
|
|
color: getColor(title),
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: List.generate(
|
|
|
|
|
values.length,
|
|
|
|
|
(index) => Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
values[index],
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style:
|
|
|
|
|
TextStyle(color: Colors.white, fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getColor(title) {
|
|
|
|
|
switch (title) {
|
|
|
|
|
case "excellent":
|
|
|
|
|
return Color(0xFF275b45);
|
|
|
|
|
case "good":
|
|
|
|
|
return Color(0xFF507a3d);
|
|
|
|
|
case "poor":
|
|
|
|
|
return Color(0xFFa86452);
|
|
|
|
|
case "atRisk":
|
|
|
|
|
return Color(0xFFa2494b);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Status extends StatelessWidget {
|
|
|
|
|
final String status;
|
|
|
|
|
final String originalData;
|
|
|
|
|
|
|
|
|
|
const Status({super.key, required this.status});
|
|
|
|
|
const Status({super.key, required this.status, required this.originalData});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -191,23 +326,24 @@ class Status extends StatelessWidget {
|
|
|
|
|
borderRadius: BorderRadius.circular(3),
|
|
|
|
|
),
|
|
|
|
|
// color: Color(0xFF359846),
|
|
|
|
|
color: (status.toLowerCase() == 'good' ||
|
|
|
|
|
status.toLowerCase() == 'excellent' ||
|
|
|
|
|
status.toLowerCase() == 'normal')
|
|
|
|
|
color: (originalData.toLowerCase() == 'good' ||
|
|
|
|
|
originalData.toLowerCase() == 'excellent' ||
|
|
|
|
|
originalData.toLowerCase() == 'normal')
|
|
|
|
|
? Color(0xFFD8E8DB)
|
|
|
|
|
: (status.toLowerCase() == 'poor' || status.toLowerCase() == 'low')
|
|
|
|
|
: (originalData.toLowerCase() == 'poor' ||
|
|
|
|
|
originalData.toLowerCase() == 'low')
|
|
|
|
|
? Color(0xFFD3D37E)
|
|
|
|
|
: Color(0x98d02127),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
|
|
|
|
child: Text(status,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: (status.toLowerCase() == 'good' ||
|
|
|
|
|
status.toLowerCase() == 'excellent' ||
|
|
|
|
|
status.toLowerCase() == 'normal')
|
|
|
|
|
color: (originalData.toLowerCase() == 'good' ||
|
|
|
|
|
originalData.toLowerCase() == 'excellent' ||
|
|
|
|
|
originalData.toLowerCase() == 'normal')
|
|
|
|
|
? Color(0xFF359846)
|
|
|
|
|
: (status.toLowerCase() == 'poor' ||
|
|
|
|
|
status.toLowerCase() == 'low')
|
|
|
|
|
: (originalData.toLowerCase() == 'poor' ||
|
|
|
|
|
originalData.toLowerCase() == 'low')
|
|
|
|
|
? Colors.white
|
|
|
|
|
: Colors.white,
|
|
|
|
|
fontSize: 8,
|
|
|
|
|
|