Open JCKodel opened 3 weeks ago
I wouldn’t say that it is a good idea. The main purpose of the cupertino_calendar_picker package is to bring the SwiftUI calendar picker to Flutter (since Flutter has a wheel picker as an iOS-style version only). Therefore, there are no plans to make this component a constructor or builder for creating your own calendar from separate parts. That’s why the calendar allows full customization of the text styles and colors but doesn’t have parameters for paddings, icon widgets or animations, because in that case it might lose the original appearance of the SwiftUI version.
Here is how the SwiftUI version looks like:
If the Flutter month-year picker has some UI issues, I think the only thing I can do is bring this component from the cupertino library to my package, try to fix it and make it look the same as in SwiftUI.
There is a (lot) of bugs in Flutter Cupertino widgets, but one affects this picker:
The code on CupertinoDatePicker is naïve at best (it gets the month column width by string length - problem is:
Fevereiro
has more chars thanNovembro
, but thatm
is way wider, so, pixel-wise, the wordNovember
is a lot large thenFevereiro
.Since the Flutter team would not fix it (or it will take ages to fix, as always), it would be awesome to provide some alternatives through a builder. For instance:
If
monthPickerBuilder
is null, you can use the currentCupertinoDatePicker
(line 218 ofcalendar_picker.dart
), otherwise, this function is called and theSomeComponent()
is returned.The same could be applied for all components, such as the calendar and the calendar/month picker button.