Commit 79a72e1
Changed files (2)
lib/model/blood_pressure.dart
@@ -314,3 +314,41 @@ class BloodPressureRecord {
const BloodPressureRecord(
this.creationTime, this.systolic, this.diastolic, this.pulse, this.notes);
}
+
+// source: https://pressbooks.library.torontomu.ca/vitalsign/chapter/blood-pressure-ranges/ (last access: 20.05.2023)
+class BloodPressureWarnValues {
+ BloodPressureWarnValues._create();
+
+ static String source = 'https://pressbooks.library.torontomu.ca/vitalsign/chapter/blood-pressure-ranges/';
+
+ static int getUpperDiaWarnValue(int age) {
+ if (age <= 2) {
+ return 70;
+ } else if (age <= 13) {
+ return 80;
+ } else if (age <= 18) {
+ return 80;
+ } else if (age <= 40) {
+ return 80;
+ } else if (age <= 60) {
+ return 90;
+ } else {
+ return 90;
+ }
+ }
+ static int getUpperSysWarnValue(int age) {
+ if (age <= 2) {
+ return 100;
+ } else if (age <= 13) {
+ return 120;
+ } else if (age <= 18) {
+ return 120;
+ } else if (age <= 40) {
+ return 125;
+ } else if (age <= 60) {
+ return 145;
+ } else {
+ return 145;
+ }
+ }
+}
lib/model/settings_store.dart
@@ -1,3 +1,4 @@
+import 'package:blood_pressure_app/model/blood_pressure.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -129,6 +130,9 @@ class Settings extends ChangeNotifier {
// high blood pressure marking according to https://www.texasheart.org/heart-health/heart-information-center/topics/high-blood-pressure-hypertension/
double get sysWarn {
+ if (!overrideWarnValues) {
+ return BloodPressureWarnValues.getUpperSysWarnValue(age).toDouble();
+ }
return _prefs.getInt('sysWarn')?.toDouble() ?? 130;
}
set sysWarn(double newWarn) {
@@ -137,6 +141,9 @@ class Settings extends ChangeNotifier {
}
double get diaWarn {
+ if (!overrideWarnValues) {
+ return BloodPressureWarnValues.getUpperDiaWarnValue(age).toDouble();
+ }
return _prefs.getInt('diaWarn')?.toDouble() ?? 80;
}
set diaWarn(double newWarn) {