From 0366174ec12e86560acc59641178d12404c1ff9e Mon Sep 17 00:00:00 2001 From: derdilla Date: Tue, 18 Jul 2023 15:36:14 +0200 Subject: [PATCH] document problem --- lib/components/date_time_picker.dart | 5 +++++ lib/screens/add_measurement.dart | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/components/date_time_picker.dart b/lib/components/date_time_picker.dart index 25054c06..fc3fc095 100644 --- a/lib/components/date_time_picker.dart +++ b/lib/components/date_time_picker.dart @@ -1,6 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +/// First shows a DatePicker for the day then shows a TimePicker for the time of day. +/// +/// As per the decision of the material design team a TimePicker isn't able to limit the range +/// (https://github.com/flutter/flutter/issues/23717#issuecomment-966601311), therefore a manual check for the time of +/// day will be needed. Please refer to the validator on the AddMeasurementPage for an example Future showDateTimePicker({ required BuildContext context, DateTime? initialDate, diff --git a/lib/screens/add_measurement.dart b/lib/screens/add_measurement.dart index fe5d9c94..6d1a7e1f 100644 --- a/lib/screens/add_measurement.dart +++ b/lib/screens/add_measurement.dart @@ -83,7 +83,7 @@ class _AddMeasurementPageState extends State { messenger.showSnackBar(SnackBar(content: Text(errTimeAfterNow))); if (selectedTime.hour > now.hour) selectedTime = selectedTime.copyWith(hour: now.hour); if (selectedTime.minute > now.minute) selectedTime = selectedTime.copyWith(minute: now.minute); - } + } // validation for first date is not needed here as intervall starts at 00:00 setState(() { _time = selectedTime!; });