I'm trying to create a month/year picker in the Flutter project for both material and Cupertino styles. However, I can't find an ability to disable the days on the default date picker and the available packages only offer Cupertino-styled month pickers.
Did anyone face this kind of problem, and what was the most optimal solution? Any help is appreciated.
You need to use the
selectableDayPredicate
to control whichDateTime
should be enabled or disabled with abool
condition in your date picker :In this example, the date picker will enable all days between the 10 and 30 of this month except the day 27, it will be disabled, preview :
you can expand with your personal logic into this.