GaspardMerten / date_field

Flutter DateField and DateFormField
Other
46 stars 32 forks source link

Add a picker style property to force style (iOS/android) whilst respecting platform behaviour #69

Closed mwoelk closed 5 months ago

mwoelk commented 6 months ago

Is your feature request related to a problem? Please describe. When we want to show the android picker on iOS, we currently need to provide a new theme around it with the platform set to android. See #38.

This works fine with one rather annoying exception: Due to setting the Platform to Android, the date and time picker always provide haptic feedback by vibrating the device whenever a value is chosen. Because there are no other controls in iOS exposing this device, it is kind of disturbing to user experience if suddenly the device vibrates. This behaviour depends on the platform as seen here and here.

Describe the solution you'd like Add a new, optional enum property pickerStyle to the widget that choses which kind of picker should be shown without the need to change platform. Its behaviour should be as follows:

If the widget doesn't need to be wrapped with a different platform, the flutter picker widgets should follow the system vibration behaviour.

Describe alternatives you've considered Also tried setting the enableFeedbackto false but this seems to not apply to the pickers as they do not expose any proeprty to change vibration behaviour as seen in the links above. It solely depends on Platform.

torbenkeller commented 5 months ago

Sounds reasonable to me. @GaspardMerten what do you think?

torbenkeller commented 5 months ago

Hey @mwoelk, would the PR #70 solve your problem?

GaspardMerten commented 5 months ago

Yep! Sounds good.