Commit 0366174
Changed files (2)
lib
components
screens
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<DateTime?> showDateTimePicker({
required BuildContext context,
DateTime? initialDate,
lib/screens/add_measurement.dart
@@ -83,7 +83,7 @@ class _AddMeasurementPageState extends State<AddMeasurementPage> {
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!;
});