Closed Pierre-Monier closed 2 years ago
Hello @Pierre-Monier, if I understood your goal correctly, you want to change the selected value of the DateTimeFormField
widget without the user input.
If that's the case, please note that the architecture of the widget is the default one for form fields in Flutter. You can change the value manually by using a GlobalKey.
final fieldKey = GlobalKey<FormFieldState<DateTime>>();
void changeDate() => fieldKey.currentState?.didChange([NEW_VALUE]);
build(...) {
...DateTimeFormField(key: fieldKey, ...)...
Did I miss something?
Hum I see, I can make it works that way to. I will close my PR
I add a
selectedDate
attribute on theDateTimeFormField
class. In one project I must change the displayed value when a variable change, maybe this can be useful to other people