material_drum_picker 1.7.0
material_drum_picker: ^1.7.0 copied to clipboard
A Material 3 date picker with an iOS-style drum roller, full API parity with showDatePicker and CupertinoDatePicker, and drum, calendar and input modes.
Changelog #
1.7.0 #
- Working days only. New optional
disabledWeekdaysmakes the given weekdays unselectable in every mode, using theDateTime.weekdayconvention. For a working days only picker pass the weekend, for example{DateTime.saturday, DateTime.sunday}(or{DateTime.friday, DateTime.saturday}in much of the Middle East). - Holidays. New optional
holidays(aSet<DateTime>) marks specific dates as unselectable, compared by calendar day and ignoring the time component. - First day of the week. New optional
firstDayOfWeekoverrides the locale's start of week in calendar mode (DateTime.mondaytoDateTime.sunday). disabledWeekdays,holidays, andselectableDayPredicatecombine: a day is selectable only when it passes all of them, consistently across the drum, calendar, and input modes. The opening date snaps to the nearest selectable day, so a default that lands on a weekend or holiday does not start disabled.- All three options are available on
DrumPicker,showDrumDatePicker, andshowDrumDateTimePicker, and all are optional with no change to existing behavior.
1.6.0 #
- Chinese lunisolar calendar. Pass
calendar: DrumCalendarType.chineseto present the drum, calendar, and input modes in the Chinese calendar. It fully supports leap months (a leap year has 13 months, with the leap month 闰月 repeating the previous month's number), astronomically determined month lengths (29 or 30 days), traditional month names (正月 ... 十二月, 闰二月), and the sexagenary year with its zodiac animal (for example 癸卯, Rabbit) shown under the headline. The returned value is always a GregorianDateTime. - The month length and leap month data is computed from the BSD licensed sxtwl
astronomical engine, cross validated against a second engine, and vendored as
a pure Dart table (lunar years 1900-2100), so the package keeps its only
runtime dependencies as Flutter and
intl. No third party engine is shipped. - New public type
ChineseCalendarSystem, andDrumCalendarType.chinese. - Core calendar API additions (non breaking):
CalendarDate.isLeapMonth,DrumCalendarSystem.monthsInYear,monthLabel, andyearAnnotation, with defaults that leave the Gregorian and Hijri calendars unchanged. CustomDrumCalendarSystemimplementations with leap months or a variable month count are now possible.
1.5.0 #
- Month as a name or a number. New
monthFormatparameter (DrumMonthFormat.nameor.numeric) switches the drum month column between the abbreviated month name (the default) and a zero padded number. It works with every calendar system and locale, since a numeric month is just the month index in the locale's digits. - Configurable typed date format. New
inputFormatparameter takes aDrumDateFormatthat controls the keyboard input mode: the order of the day, month, and year fields, the separator, and whether the year is two or four digits. Build one from a pattern withDrumDateFormat.parse('DD-MM-YYYY'), or use a preset (DrumDateFormat.mdy,.dmy,.ymd). The format drives the field's value, hint, and parsing in whatever calendar the picker is using, and a two digit year is resolved into the supported range at the year nearest the current selection. - Both additions default to the previous behavior (month names and
MM/DD/YYYY) and are available onDrumPicker,showDrumDatePicker, andshowDrumDateTimePicker. Existing output is unchanged.
1.4.0 #
- Deep visual theming.
DrumPickerThemegains a much larger token set: typography (headlineTextStyle,helpTextStyle,secondaryTextStyle,columnLabelTextStyle,selectedItemTextStyle,unselectedItemTextStyle), the calendar grid colors that were previously hard coded (dayForegroundColor,selectedDayBackgroundColor,selectedDayForegroundColor,todayColor,disabledDayColor), and shape and spacing (dayShape,selectorBandRadius,headerPadding). Text style tokens merge over the defaults, so you can change one field (for example the weight) without losing the themed color. - Per-instance theming.
DrumPicker,DrumTimePicker, and theshowDrum*Pickerfunctions take a newthemeparameter. It is merged over any ambientDrumPickerThemeextension, so you can style a single picker without touching the app theme. The calendar grid now honors the theme tokens too (previously it always used the rawColorScheme). - Overridable labels. New
DrumPickerLabelslets you translate or relabel the fixed UI strings that were not otherwise localized: the drum column headers (DAY, MONTH, YEAR), the time strip headers (HOUR, MIN, AM/PM), the mode toggle (Calendar, Drum, Input), and the default quick select chips. - Custom input decoration. A new
inputDecorationparameter lets the input mode field inherit your app'sInputDecorationThemeor a custom decoration. - Fully backward compatible: every new token and parameter defaults to the previous appearance and behavior, so existing output is unchanged.
1.3.0 #
- Hijri (Umm al-Qura) calendar. Pass
calendar: DrumCalendarType.hijrito show the drum, calendar, and input modes in the lunar Hijri calendar, fully composed with the existing right to left support. The returned value is still a GregorianDateTime. The Umm al-Qura table is vendored as pure Dart, so the package keeps its only runtime dependencies as Flutter andintl. - Pluggable data backed calendars. New
TabularLunarCalendarSystemlets you drive the picker from a published dataset of Hijri month start dates (for an official or committee lunar calendar). Pass an instance through the newcalendarSystemparameter, which takes precedence overcalendar. The package ships only the mechanism and a documented schema, never any specific publisher's data. Malformed datasets are rejected rather than producing wrong dates. - New public types:
DrumCalendarType,DrumCalendarSystem,GregorianCalendarSystem,HijriCalendarSystem,TabularLunarCalendarSystem,TabularLunarMonth, andCalendarDate. - New
showGregorianAlongsideflag (off by default) renders the Gregorian equivalent as a small secondary line in the header. - Day, month, and year numbers now route through one locale aware numeral path, so a locale that uses Arabic-Indic digits renders them consistently across the drum, calendar, input, and header.
- No breaking changes. Every new parameter defaults to the previous Gregorian behavior, and all existing tests and goldens pass unchanged.
1.2.0 #
- Time-only picking. New
DrumTimePickerwidget andshowDrumTimePickerfunction that return aTimeOfDay. Configurable for AM/PM (12 hour) or 24 hour mode viause24hFormat(which falls back toMediaQuery.alwaysUse24HourFormat), withminuteIntervalgranularity. - Example app gains a "Time only" screen (12 hour dialog, 24 hour dialog with 5 minute steps, and an inline 15 minute picker).
- README rewritten and expanded: a pickers overview table plus dedicated date+time and time-only screenshots.
1.1.0 #
- Date + time picking.
DrumPickergainspickTime,use24hFormat, andminuteInterval. WhenpickTimeis true, a compact time drum strip (hour, minute, and AM/PM in 12-hour mode) appears below the date selector and the confirmed value includes the chosen time. - New
showDrumDateTimePickerconvenience function, the same API asshowDrumDatePickerbut returns aDateTimethat carries the time. use24hFormatfalls back toMediaQuery.alwaysUse24HourFormat; AM/PM labels and the header time are localized.minuteIntervalsnaps the initial minute and is asserted to divide 60.
1.0.0 #
Initial release.
showDrumDatePicker, a drop-in replacement for Flutter'sshowDatePickerwith full parameter parity (firstDate,lastDate,initialDate,currentDate,selectableDayPredicate,helpText,confirmText,cancelText,errorFormatText,errorInvalidText,fieldHintText,fieldLabelText,locale,textDirection,barrierDismissible,barrierColor,barrierLabel,useRootNavigator,routeSettings,restorationId,anchorPoint,builder).DrumPickerinline widget for embedding in forms (no dialog).- Three context-aware input modes:
drum,calendar, andinput, with a mode toggle. selectableDayPredicateenforced in all three modes, including nearest-valid-date snapping in drum mode.- Quick-select chips with
quickSelectOptionsandDrumQuickSelect.relative. - Configurable
columnOrder(dmy/mdy/ymd/ydm) with locale-aware defaults, plusshowDayOfWeekInDrum. DrumPickerThemeextension for Material 3 token overrides.- Full RTL and localization support via
intlandflutter_localizations. showDrumDateRangePickerAPI stub (throwsUnimplementedError; full implementation planned for 1.1.0).