DateTimeField(
// Is disabled for iOS, only it's decoration is being used.
enabled: platformIsAndroid,
controller: _deadlineController,
format: CreatePollModel.deadLineFormat,
style: Properties.black16RegTextField,
maxLines: 1,
onShowPicker: (context, currentValue) async {
final now = DateTime.now();
final date = await showDatePicker(
context: context,
firstDate: now,
initialDate: now,
lastDate: widget.model.maxDate,
);
if (date != null) {
final time = await showTimePicker(
context: context,
initialTime: TimeOfDay.fromDateTime(currentValue ?? now),
);
return DateTimeField.combine(date, time);
} else {
return currentValue;
}
},
onFieldSubmitted: widget.model.updateDeadLine,
),
The calendar correctly disables the previous dates from DateTime.now() but when the user selects the current day, the time picker does not "remember" that it shouldn't allow to use an earlier time from the day.
This is the widget I'm working with:
The calendar correctly disables the previous dates from
DateTime.now()
but when the user selects the current day, the time picker does not "remember" that it shouldn't allow to use an earlier time from the day.Please confirm if I'm doing something wrong.
related https://github.com/jifalops/datetime_picker_formfield/issues/25#issuecomment-473597378