diff --git a/lib/vital_signs/components/barWidget.dart b/lib/vital_signs/components/barWidget.dart index 6ef40422..d59e6b51 100644 --- a/lib/vital_signs/components/barWidget.dart +++ b/lib/vital_signs/components/barWidget.dart @@ -33,8 +33,15 @@ class CustomResultProgressBar extends StatelessWidget { final double percentage; final String value; final ResultTypes type; + final bool showAtRisk; - const CustomResultProgressBar({Key? key, required this.percentage, required this.value, required this.type}) : super(key: key); + const CustomResultProgressBar( + {Key? key, + required this.percentage, + required this.value, + required this.type, + this.showAtRisk = false}) + : super(key: key); @override Widget build(BuildContext context) { @@ -70,11 +77,15 @@ class CustomResultProgressBar extends StatelessWidget { SizedBox( width: spacing, ), - // _buildResultBar( - // flex: 2, - // color: Color(0xFFEAB157), - // title: "High", - // ), + + Visibility( + visible: showAtRisk, + child: _buildResultBar( + flex: 2, + color: Color(0xFFE82626), + title: "At Risk", + ), + ), // SizedBox( // width: spacing, // ), @@ -92,7 +103,13 @@ class CustomResultProgressBar extends StatelessWidget { children: [ TextCloud( text: "${value}", - color: percentage == 4 ? Color(0xFFDE7676) : percentage == 40 ? Color(0xff84d368) : Color(0xFF14a45f), + color: percentage == 4 + ? Color(0xFFDE7676) + : percentage == 40 + ? Color(0xff84d368) + : percentage == 85 + ? Color(0xFFE82626) + : Color(0xFF14a45f), // color: type == ResultTypes.criticalLow || type == ResultTypes.criticalHigh // ? Color(0xFFDE7676) // : type == ResultTypes.low || type == ResultTypes.high @@ -263,6 +280,7 @@ class ItemResultCardWidgetWithParamsVitalSign extends StatelessWidget { final String buttonText; final ResultTypes type; final bool isArabic; + final bool showAtRisk; final Function()? onButtonPressed; const ItemResultCardWidgetWithParamsVitalSign({ @@ -277,6 +295,7 @@ class ItemResultCardWidgetWithParamsVitalSign extends StatelessWidget { required this.type, this.onButtonPressed, this.isArabic = false, + this.showAtRisk = false, }) : super(key: key); @override @@ -372,7 +391,7 @@ class ItemResultCardWidgetWithParamsVitalSign extends StatelessWidget { percentage: percentage, value: subTitle, type: type, - ), + showAtRisk: showAtRisk), ), // const SizedBox(height: 12), // Note Section diff --git a/lib/vital_signs/components/vital_sign_widget.dart b/lib/vital_signs/components/vital_sign_widget.dart index 3c007fe5..8e2f7c2b 100644 --- a/lib/vital_signs/components/vital_sign_widget.dart +++ b/lib/vital_signs/components/vital_sign_widget.dart @@ -1,10 +1,7 @@ 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/components/barWidget.dart'; import 'package:diplomaticquarterapp/vital_signs/data/vitals_benchmark.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; class VitalSignWidget extends StatelessWidget { final String vitalSignName; @@ -111,7 +108,8 @@ class VitalSignWidget extends StatelessWidget { note: "Mayoclinic is the source of pediatrics value", source: "source", buttonText: "Click", - type: ResultTypes.criticalLow) + showAtRisk: vitalName == 'bmi', + type: ResultTypes.criticalLow) // else if (condition is RangeConditionForBloodPressure) // Status( // status: "${TranslationBase.of(context).getValue(condition.systolic?.systolic.interpretation ?? '')}", @@ -346,13 +344,18 @@ class VitalSignWidget extends StatelessWidget { switch (interpretationValue) { case "poor": + case "atRisk": percent = 4; case "good": percent = 40; case "excellent": - percent = 75; + if (vitalName == 'bmi') + percent = 55; + else + percent = 75; } + if (interpretationValue == "atRisk" && vitalName == 'bmi') percent = 85; return percent; } @@ -365,7 +368,7 @@ class VitalSignWidget extends StatelessWidget { case "poor": return Color(0xFFDE7676); case "atRisk": - return Color(0xFFa2494b); + return Color(0xFFE82626); } } diff --git a/lib/vital_signs/data/vitals_benchmark.dart b/lib/vital_signs/data/vitals_benchmark.dart index 7ef98a74..c1c58674 100644 --- a/lib/vital_signs/data/vitals_benchmark.dart +++ b/lib/vital_signs/data/vitals_benchmark.dart @@ -218,7 +218,7 @@ var vital = { },{ "min": 25, "max": 30, - "interpretation": "poor", + "interpretation": "good", "quantitativeInterpretation": "normal", "title": "25-30" },