GaspardMerten / date_field

Flutter DateField and DateFormField
Other
45 stars 32 forks source link

onChanged called after cancel button is clicked #79

Open litterature opened 3 weeks ago

litterature commented 3 weeks ago

Describe the bug I have a nullable time field. When I click on DateTimeFormField for a null time to set a date and then click 'Cancel' to cancel the change, 'onChanged' is fired and change my field anyway. It should not modify my field or at least it should be null like initialValue.

To Reproduce Steps to reproduce the behavior:

  1. Click on DateTimeFormField with null initialValue
  2. Click on 'Cancel'
  3. See that onChanged is executed with the default value of widget (instead of null)

Expected behavior If "initialValue" is null at first and then I click "Cancel", it should not trigger "onChanged". If it must execute "onChanged", the value returned should be null.

Screenshots image

Desktop (please complete the following information):