Skip to content

Commit

Permalink
Fixes informed consent cross button (#168)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LarsRefsgaard authored Jul 19, 2023
1 parent 8fff8d3 commit 1d6e97c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 32 deletions.
25 changes: 0 additions & 25 deletions lib/ui/pages/informed_consent_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,6 @@ class InformedConsentState extends State<InformedConsentPage> {
}
}

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: <Widget>[
TextButton(
child: Text(locale.translate("pages.ic.go_to_ic")),
onPressed: () {
context.go('/consent');
},
)
],
);
},
);
}

@override
Widget build(BuildContext context) {
RPLocalizations localization = RPLocalizations.of(context)!;
Expand All @@ -64,7 +40,6 @@ class InformedConsentState extends State<InformedConsentPage> {
return RPUITask(
task: snapshot.data!,
onSubmit: resultCallback,
onCancel: cancelCallback,
);
}
}
Expand Down
18 changes: 12 additions & 6 deletions lib/view_models/cards/heart_rate_data_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1d6e97c

Please sign in to comment.