GaspardMerten / date_field

Flutter DateField and DateFormField
Other
46 stars 32 forks source link

Rework of the widget #49

Closed torbenkeller closed 10 months ago

torbenkeller commented 1 year ago

Hey :),

I just reworked the whole widget in order to provide a more intuitive api and added a few features within it.

There are some breaking changes such as:

There are also new features such as:

I hope I got all changes. This is a first draft so let me know what you think about it.

GaspardMerten commented 11 months ago

Hello,

Thank you for this neat PR.

Do you think it could be better to still keep the older denomination with the new one and to simply mark it as deprecated for a time?

torbenkeller commented 10 months ago

I would say, let's try to get the api of the widget as consistant to default flutter form fields as possible. That means we would have breaking changes in the current api. I would suggest to add the reworked widget as a separate widget and add a deprecation annotation to the current one. Then we can give people time to migrate and release a major version 4 that removes the old widgets and renames the reworked widgets to the current names.

The pr is still not ready and I have to put some time into it, but I hope I get it ready until the end of the week.

torbenkeller commented 10 months ago

I also noticed the usability on mac os is really bad with the modal and caroussel. How could we improve that? Use the material dialog? Or use the InputDatePickerFormField? Or let the user decide by accepting a callback?

torbenkeller commented 10 months ago

On IOS there are 3 ways to submit a date time: https://developer.apple.com/design/human-interface-guidelines/pickers#iOS-iPadOS

The style of the current widget is similar as the wheels option, but we should match the modal style of the original widget to the iOS guidelines.

Maybe in the future it makes sense to build a CupertinoDateTimeField that looks as the native iOS component and suports all 3 modes. Then we could add an adaptive factory to the normal DateTimePicker to support material and cupertino appearance and behavior. That would improve the quality of the package enormous in my opinion.

torbenkeller commented 10 months ago

@GaspardMerten what do you think?

torbenkeller commented 10 months ago

I spent some time on finishing my PR. It is mostly complete and I will update the ready PR hopefully today.

I also thought about the migration strategy. I will keep the api as consistant as possible. There will be just one breaking change in the api: onDateSelected -> onChanged, because onChanged will be required and also accepts nullable DateTime's. All other changes in the api will be marked deprecated and I will make dart fix apply the migration automatically. In version 5.0.0 we can then remove all the deprecated parameters and clean up the api.

torbenkeller commented 10 months ago

The PR is pretty much ready. Left things are:

torbenkeller commented 10 months ago

@GaspardMerten The PR is ready for review and merge. After the merge, we must update the paths to the gifs in the readme and use the full url to the github location. Otherwise the gifs will not be shown on pub.

torbenkeller commented 10 months ago

Also you can ignore the macos, linux and windows folders in the example project. I just used flutter create to test on the platforms

torbenkeller commented 10 months ago

This PR would close #41, #45, #46, #48, #50, #52 and #53

GaspardMerten commented 10 months ago

Hello @torbenkeller ,

Thank you for this excellent Pull request and the well-needed modernization it brings to this package.