|
|
|
@ -11,6 +11,7 @@ enum VitalSignStatus {
|
|
|
|
obese,
|
|
|
|
obese,
|
|
|
|
overweight,
|
|
|
|
overweight,
|
|
|
|
underweight,
|
|
|
|
underweight,
|
|
|
|
|
|
|
|
skinny,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// UI-only helper model for Vital Sign cards.
|
|
|
|
/// UI-only helper model for Vital Sign cards.
|
|
|
|
@ -34,8 +35,9 @@ class VitalSignUiModel {
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// Rules:
|
|
|
|
/// Rules:
|
|
|
|
/// - Height is always blue.
|
|
|
|
/// - Height is always blue.
|
|
|
|
/// - High, Obese, Overweight => red scheme.
|
|
|
|
/// - High, Obese => red scheme.
|
|
|
|
/// - Low, Underweight => yellow scheme.
|
|
|
|
/// - Overweight => orange scheme.
|
|
|
|
|
|
|
|
/// - Low, Underweight, Skinny => yellow scheme.
|
|
|
|
/// - Otherwise => green scheme (Normal).
|
|
|
|
/// - Otherwise => green scheme (Normal).
|
|
|
|
static VitalSignUiModel scheme({required VitalSignStatus? status, required String label}) {
|
|
|
|
static VitalSignUiModel scheme({required VitalSignStatus? status, required String label}) {
|
|
|
|
final l = label.toLowerCase();
|
|
|
|
final l = label.toLowerCase();
|
|
|
|
@ -50,10 +52,8 @@ class VitalSignUiModel {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// High, Obese, Overweight => red scheme (health concerns)
|
|
|
|
// High, Obese => red scheme (health concerns)
|
|
|
|
if (status == VitalSignStatus.high ||
|
|
|
|
if (status == VitalSignStatus.high || status == VitalSignStatus.obese) {
|
|
|
|
status == VitalSignStatus.obese ||
|
|
|
|
|
|
|
|
status == VitalSignStatus.overweight) {
|
|
|
|
|
|
|
|
return VitalSignUiModel(
|
|
|
|
return VitalSignUiModel(
|
|
|
|
iconBg: AppColors.chipSecondaryLightRedColor,
|
|
|
|
iconBg: AppColors.chipSecondaryLightRedColor,
|
|
|
|
iconFg: AppColors.primaryRedColor,
|
|
|
|
iconFg: AppColors.primaryRedColor,
|
|
|
|
@ -62,8 +62,20 @@ class VitalSignUiModel {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Low, Underweight => yellow scheme (warning)
|
|
|
|
// Overweight => orange scheme (warning)
|
|
|
|
if (status == VitalSignStatus.low || status == VitalSignStatus.underweight) {
|
|
|
|
if (status == VitalSignStatus.overweight) {
|
|
|
|
|
|
|
|
return VitalSignUiModel(
|
|
|
|
|
|
|
|
iconBg: AppColors.warningColorYellow.withValues(alpha: 0.12),
|
|
|
|
|
|
|
|
iconFg: AppColors.warningColorYellow,
|
|
|
|
|
|
|
|
chipBg: AppColors.warningColorYellow.withValues(alpha: 0.12),
|
|
|
|
|
|
|
|
chipFg: AppColors.warningColorYellow,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Low, Underweight, Skinny => yellow scheme (warning)
|
|
|
|
|
|
|
|
if (status == VitalSignStatus.low ||
|
|
|
|
|
|
|
|
status == VitalSignStatus.underweight ||
|
|
|
|
|
|
|
|
status == VitalSignStatus.skinny) {
|
|
|
|
final Color yellowBg = AppColors.highAndLow.withValues(alpha: 0.12);
|
|
|
|
final Color yellowBg = AppColors.highAndLow.withValues(alpha: 0.12);
|
|
|
|
return VitalSignUiModel(
|
|
|
|
return VitalSignUiModel(
|
|
|
|
iconBg: yellowBg,
|
|
|
|
iconBg: yellowBg,
|
|
|
|
@ -98,6 +110,8 @@ class VitalSignUiModel {
|
|
|
|
return LocaleKeys.vitalSignOverweight.tr();
|
|
|
|
return LocaleKeys.vitalSignOverweight.tr();
|
|
|
|
case VitalSignStatus.underweight:
|
|
|
|
case VitalSignStatus.underweight:
|
|
|
|
return LocaleKeys.vitalSignUnderweight.tr();
|
|
|
|
return LocaleKeys.vitalSignUnderweight.tr();
|
|
|
|
|
|
|
|
case VitalSignStatus.skinny:
|
|
|
|
|
|
|
|
return LocaleKeys.vitalSignSkinny.tr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -131,22 +145,30 @@ class VitalSignUiModel {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// BMI >= 25 (Overweight or Obese) => High
|
|
|
|
// BMI >= 30 (Obese) => Red
|
|
|
|
if (bmiResult >= 25) {
|
|
|
|
if (bmiResult >= 30) {
|
|
|
|
return VitalSignStatus.high;
|
|
|
|
return VitalSignStatus.obese;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// BMI >= 25 (Overweight) => Orange
|
|
|
|
|
|
|
|
else if (bmiResult >= 25) {
|
|
|
|
|
|
|
|
return VitalSignStatus.overweight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// BMI >= 18.5 and < 25 => Normal
|
|
|
|
// BMI >= 18.5 (Normal) => Green
|
|
|
|
else if (bmiResult >= 18.5) {
|
|
|
|
else if (bmiResult >= 18.5) {
|
|
|
|
return VitalSignStatus.normal;
|
|
|
|
return VitalSignStatus.normal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// BMI < 18.5 (Underweight) => Low
|
|
|
|
// BMI >= 16 (Underweight) => Yellow
|
|
|
|
|
|
|
|
else if (bmiResult >= 16) {
|
|
|
|
|
|
|
|
return VitalSignStatus.underweight;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// BMI < 16 (Skinny/Severely underweight) => Yellow
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
return VitalSignStatus.low;
|
|
|
|
return VitalSignStatus.skinny;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Weight status based on BMI with detailed classification
|
|
|
|
/// Weight status based on BMI with detailed classification
|
|
|
|
/// Returns: Obese, Overweight, Normal, Underweight
|
|
|
|
/// Returns: Obese, Overweight, Normal, Underweight, Skinny
|
|
|
|
static VitalSignStatus? weightStatus(dynamic bmi) {
|
|
|
|
static VitalSignStatus? weightStatus(dynamic bmi) {
|
|
|
|
// Return null if BMI is not available or is 0
|
|
|
|
// Return null if BMI is not available or is 0
|
|
|
|
final double bmiResult = double.tryParse(bmi.toString()) ?? 0;
|
|
|
|
final double bmiResult = double.tryParse(bmi.toString()) ?? 0;
|
|
|
|
@ -155,15 +177,26 @@ class VitalSignUiModel {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// BMI >= 30 (Obese) => Red
|
|
|
|
if (bmiResult >= 30) {
|
|
|
|
if (bmiResult >= 30) {
|
|
|
|
return VitalSignStatus.obese;
|
|
|
|
return VitalSignStatus.obese;
|
|
|
|
} else if (bmiResult >= 25) {
|
|
|
|
}
|
|
|
|
|
|
|
|
// BMI >= 25 (Overweight) => Orange
|
|
|
|
|
|
|
|
else if (bmiResult >= 25) {
|
|
|
|
return VitalSignStatus.overweight;
|
|
|
|
return VitalSignStatus.overweight;
|
|
|
|
} else if (bmiResult >= 18.5) {
|
|
|
|
}
|
|
|
|
|
|
|
|
// BMI >= 18.5 (Normal) => Green
|
|
|
|
|
|
|
|
else if (bmiResult >= 18.5) {
|
|
|
|
return VitalSignStatus.normal;
|
|
|
|
return VitalSignStatus.normal;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
// BMI >= 16 (Underweight) => Yellow
|
|
|
|
|
|
|
|
else if (bmiResult >= 16) {
|
|
|
|
return VitalSignStatus.underweight;
|
|
|
|
return VitalSignStatus.underweight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// BMI < 16 (Skinny/Severely underweight) => Yellow
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
return VitalSignStatus.skinny;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|