From 338112f0cc39b2712bbafea265b23f1280531898 Mon Sep 17 00:00:00 2001 From: Lars Refsgaard <1552887+LarsRefsgaard@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:29:19 +0200 Subject: [PATCH] Fixes informed consent cross button (#168) Remove code for cancel button on IC page This approach is pretty bad as both the cancel and the cross button does the thing, and it is not something we can control on the frontend. --- lib/ui/pages/informed_consent_page.dart | 25 ------------------- .../cards/heart_rate_data_model.dart | 18 ++++++++----- pubspec.yaml | 2 +- 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/lib/ui/pages/informed_consent_page.dart b/lib/ui/pages/informed_consent_page.dart index a2d8915c..55944329 100644 --- a/lib/ui/pages/informed_consent_page.dart +++ b/lib/ui/pages/informed_consent_page.dart @@ -19,30 +19,6 @@ class InformedConsentState extends State { } } - void cancelCallback(RPTaskResult? result) async { - info("$runtimeType - Informed Consent canceled"); - - await showDialog( - context: context, - barrierDismissible: false, - builder: (BuildContext context) { - RPLocalizations locale = RPLocalizations.of(context)!; - - return AlertDialog( - title: Text(locale.translate("pages.ic.need_accept")), - actions: [ - TextButton( - child: Text(locale.translate("pages.ic.go_to_ic")), - onPressed: () { - context.go('/consent'); - }, - ) - ], - ); - }, - ); - } - @override Widget build(BuildContext context) { RPLocalizations localization = RPLocalizations.of(context)!; @@ -64,7 +40,6 @@ class InformedConsentState extends State { return RPUITask( task: snapshot.data!, onSubmit: resultCallback, - onCancel: cancelCallback, ); } } diff --git a/lib/view_models/cards/heart_rate_data_model.dart b/lib/view_models/cards/heart_rate_data_model.dart index e0fd3403..c480211e 100644 --- a/lib/view_models/cards/heart_rate_data_model.dart +++ b/lib/view_models/cards/heart_rate_data_model.dart @@ -105,12 +105,18 @@ class HourlyHeartRate extends DataModel { currentHeartRate = heartRate; if (hourlyHeartRate.containsKey(hour)) { - hourlyHeartRate.update( - hour, - (value) => value - ..min = value.min != null ? min(value.min!, heartRate) : heartRate - ..max = value.max != null ? max(value.max!, heartRate) : heartRate, - ); + hourlyHeartRate.update(hour, (value) { + double? minVal = value.min, maxVal = value.max; + if (minVal != null && maxVal != null) { + return value + ..min = min(minVal, heartRate) + ..max = max(maxVal, heartRate); + } else { + return value + ..min = heartRate + ..max = heartRate; + } + }); } else { hourlyHeartRate[hour] = HeartRateMinMaxPrHour(heartRate, heartRate); } diff --git a/pubspec.yaml b/pubspec.yaml index 0c1b566e..361e72a2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: 'none' version: 1.1.0 environment: - sdk: ">=2.17.0 <4.0.0" + sdk: ">=2.19.0 <4.0.0" flutter: ">=3.0.0" dependencies: