fix date picker not saving values

This commit is contained in:
Niels Gorter 2022-11-29 15:03:15 +01:00
parent a6a3a389b5
commit 01acdf22aa
2 changed files with 2 additions and 2 deletions

View file

@ -57,7 +57,7 @@ class _MyHomePageState extends State<MyHomePage> {
}, },
), ),
FlutterFormInputDateTime( FlutterFormInputDateTime(
inputType: FlutterFormDateTimeType.dateTime, inputType: FlutterFormDateTimeType.date,
dateFormat: DateFormat('dd/MM/yyyy HH:mm'), dateFormat: DateFormat('dd/MM/yyyy HH:mm'),
onChanged: (v) { onChanged: (v) {
print('Date changed to $v'); print('Date changed to $v');

View file

@ -128,7 +128,7 @@ class _DateInputFieldState extends ConsumerState<DateTimeInputField> {
keyboardType: TextInputType.none, keyboardType: TextInputType.none,
readOnly: true, readOnly: true,
key: Key(currentValue.toString()), key: Key(currentValue.toString()),
initialValue: widget.initialValue, initialValue: currentValue.isEmpty ? widget.initialValue : currentValue,
onSaved: (value) => widget.onSaved?.call(value), onSaved: (value) => widget.onSaved?.call(value),
onTap: () async { onTap: () async {
String userInput = await getInputFromUser(widget.inputType); String userInput = await getInputFromUser(widget.inputType);