Closed danw8989 closed 3 years ago
You should probably use the value property!
But there is no value property.
DateTimeFormField({
Key? key,
FormFieldSetter<DateTime>? onSaved,
FormFieldValidator<DateTime>? validator,
DateTime? initialValue,
AutovalidateMode? autovalidateMode,
bool enabled = true,
TextStyle? dateTextStyle,
DateFormat? dateFormat,
DateTime? firstDate,
DateTime? lastDate,
DateTime? initialDate,
ValueChanged<DateTime>? onDateSelected,
InputDecoration? decoration,
DatePickerEntryMode initialEntryMode = DatePickerEntryMode.calendar,
DatePickerMode initialDatePickerMode = DatePickerMode.day,
DateTimeFieldPickerMode mode = DateTimeFieldPickerMode.dateAndTime,
})
Oh right, you can't modify the value of the form field from the widget itself since it uses the value from the form !
If you need to modify the value you can use the none-form widget which has a selectedDate attribute.
Ok, thank you very much for the feedback.
Sorry, I have the same problem. I want to change value of displayed date on rebuild. This is not working. Are you saying that this widget supports only initial value on build but not on rebuild?
Widget doesn't change its content on rebuild when initialValue changes to null.