|
| 1 | +# 7.0.0 [Breaking] |
| 2 | + |
| 3 | +## Theming API |
| 4 | + |
| 5 | +All per-widget styling parameters on `DatePicker`, `RangeDatePicker`, `DaysPicker`, `RangeDaysPicker`, `MonthPicker`, `YearsPicker`, `showDatePickerDialog`, and `showRangePickerDialog` were removed. Use a single `theme` argument of type `DatePickerPlusTheme` instead. |
| 6 | + |
| 7 | +Removed parameters (names vary slightly between single-date and range pickers): |
| 8 | + |
| 9 | +- `daysOfTheWeekTextStyle` |
| 10 | +- `enabledCellsTextStyle` / `enabledCellsDecoration` |
| 11 | +- `disabledCellsTextStyle` / `disabledCellsDecoration` |
| 12 | +- `currentDateTextStyle` / `currentDateDecoration` |
| 13 | +- `selectedCellTextStyle` / `selectedCellDecoration` |
| 14 | +- On range pickers: `selectedCellsTextStyle` / `selectedCellsDecoration`, `singleSelectedCellTextStyle` / `singleSelectedCellDecoration` |
| 15 | +- `leadingDateTextStyle` |
| 16 | +- `slidersColor` / `slidersSize` |
| 17 | +- `highlightColor` / `splashColor` / `splashRadius` |
| 18 | +- `centerLeadingDate` |
| 19 | + |
| 20 | +**How to fix:** Build a `DatePickerPlusTheme` and pass it as `theme:`. It merges with `DatePickerPlusTheme.defaults(context)` and any `Theme.of(context).extension<DatePickerPlusTheme>()`. |
| 21 | + |
| 22 | +```dart |
| 23 | +// Before (v6) |
| 24 | +DatePicker( |
| 25 | + minDate: minDate, |
| 26 | + maxDate: maxDate, |
| 27 | + initialDate: DateTime.now(), |
| 28 | + slidersColor: Colors.blue, |
| 29 | + centerLeadingDate: true, |
| 30 | + selectedCellDecoration: BoxDecoration(color: Colors.red, shape: BoxShape.circle), |
| 31 | +); |
| 32 | +
|
| 33 | +// After (v7) |
| 34 | +DatePicker( |
| 35 | + minDate: minDate, |
| 36 | + maxDate: maxDate, |
| 37 | + displayedDate: DateTime.now(), |
| 38 | + theme: const DatePickerPlusTheme( |
| 39 | + headerTheme: HeaderTheme( |
| 40 | + centerLeadingDate: true, |
| 41 | + ), |
| 42 | + daysPickerTheme: DaysPickerTheme( |
| 43 | + selectedCellDecoration: BoxDecoration(color: Colors.red, shape: BoxShape.circle), |
| 44 | + ), |
| 45 | + // Notice how each picker has its own theme now. |
| 46 | + monthsPickerTheme: MonthsPickerTheme( |
| 47 | + selectedCellDecoration: BoxDecoration(color: Colors.red, shape: BoxShape.circle), |
| 48 | + ), |
| 49 | + yearsPickerTheme: YearsPickerTheme( |
| 50 | + selectedCellDecoration: BoxDecoration(color: Colors.red, shape: BoxShape.circle), |
| 51 | + ), |
| 52 | + rangePickerTheme: RangePickerTheme( |
| 53 | + selectedCellsDecoration: BoxDecoration(color: Colors.red, shape: BoxShape.circle), |
| 54 | + ), |
| 55 | + ), |
| 56 | +); |
| 57 | +``` |
| 58 | + |
| 59 | +You can also register defaults app-wide via `ThemeData.extensions`: |
| 60 | + |
| 61 | +```dart |
| 62 | +MaterialApp( |
| 63 | + theme: ThemeData( |
| 64 | + extensions: const <ThemeExtension<dynamic>>[ |
| 65 | + DatePickerPlusTheme( |
| 66 | + headerTheme: HeaderTheme(centerLeadingDate: true), |
| 67 | + ), |
| 68 | + ], |
| 69 | + ), |
| 70 | +); |
| 71 | +``` |
| 72 | + |
| 73 | +For defaults that depend on `ColorScheme` / `TextTheme`, build the extension where you have a `BuildContext` (e.g. inside `build`) or merge `DatePickerPlusTheme.defaults(context)` with your overrides on each picker’s `theme` argument. |
| 74 | + |
| 75 | +## `initialDate` renamed to `displayedDate` |
| 76 | + |
| 77 | +On all pickers and on `showDatePickerDialog` / `showRangePickerDialog`, rename `initialDate` to `displayedDate`. Behavior is unchanged: it controls which month/year grid is shown first. |
| 78 | + |
| 79 | +```dart |
| 80 | +// Before |
| 81 | +showDatePickerDialog(context: context, minDate: minDate, maxDate: maxDate, initialDate: someDate); |
| 82 | +
|
| 83 | +// After |
| 84 | +showDatePickerDialog(context: context, minDate: minDate, maxDate: maxDate, displayedDate: someDate); |
| 85 | +``` |
| 86 | + |
| 87 | +## Removed `previousPageSemanticLabel` & `nextPageSemanticLabel` |
| 88 | + |
| 89 | +All semantic labels are now managed internally using Material localizations. |
| 90 | + |
| 91 | +## New in v7 |
| 92 | + |
| 93 | +- **`onDisplayedMonthChanged`:** Fires when the days grid’s visible month changes (including initial build and page swipes). Argument is the first day of that month. Available on `DatePicker`, `RangeDatePicker`, `DaysPicker`, `RangeDaysPicker`, and both dialog helpers. |
| 94 | + |
| 95 | +- **`cellBuilder`:** Optional `CellBuilder` to customize cells. Uses `CellData` variants (`WeekDayCell`, `DayCell`, `MonthCell`, `YearCell`) and `CellState`. |
| 96 | + |
| 97 | +- **`DatePickerPlusTheme.isEnabled`:** When `false`, the picker is view-only (no taps, header navigation, or page swipes). |
| 98 | + |
| 99 | +- **`HeaderTheme.forwardButtonDecoration` / `backwardButtonDecoration` narrowed to `ShapeDecoration` [Breaking]:** The type was `Decoration?` and is now `ShapeDecoration?`. This eliminates an internal conversion heuristic that could not reliably derive an ink-clip shape from arbitrary `Decoration` subclasses. Migrate by replacing any `BoxDecoration` passed to these fields with an equivalent `ShapeDecoration`: |
| 100 | + |
| 101 | + ```dart |
| 102 | + // Before |
| 103 | + forwardButtonDecoration: BoxDecoration( |
| 104 | + borderRadius: BorderRadius.circular(6), |
| 105 | + color: Colors.red, |
| 106 | + ), |
| 107 | +
|
| 108 | + // After |
| 109 | + forwardButtonDecoration: ShapeDecoration( |
| 110 | + color: Colors.red, |
| 111 | + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)), |
| 112 | + ), |
| 113 | + ``` |
| 114 | + |
| 115 | +- **Non-square grid cells and the range picker:** Grid cell width and height are now fully independent (width from `columnCount`, height from `rowCount`), enabling taller cells for content such as event dots below the day number. When cells are taller than they are wide, the default circle edge decoration will be smaller than the full-height range highlight rectangle painted by `RangeSelectionPainter`. Use `OvalBorder` or `StadiumBorder` for `RangePickerTheme.selectedEdgeCellDecoration` to match the highlight, or supply a custom painter via `RangePickerTheme.resolvePainter`: |
| 116 | + |
| 117 | + ```dart |
| 118 | + rangePickerTheme: RangePickerTheme( |
| 119 | + selectedEdgeCellDecoration: ShapeDecoration( |
| 120 | + color: colorScheme.primary, |
| 121 | + shape: const OvalBorder(), |
| 122 | + ), |
| 123 | + ), |
| 124 | + ``` |
| 125 | + |
1 | 126 | # 6.0.0 |
2 | 127 |
|
3 | 128 | - Revert removing `DeviceOrientationBuilder` in favor of rename it. |
4 | 129 | - Fix semantic. fixes [#39](https://github.com/hasanmhallak/date_picker/issues/39) |
5 | 130 | - Resolve conflicts with Flutter v3.41.0. fixes [#43](https://github.com/hasanmhallak/date_picker/issues/43) |
6 | | -- Add decoration to the pageview sliders. |
| 131 | +- Add decoration to the pageview arrow buttons. |
7 | 132 |
|
8 | 133 | # 5.0.0 |
9 | 134 |
|
@@ -67,7 +192,7 @@ final date = await showDatePickerDialog( |
67 | 192 |
|
68 | 193 | - Fixed an overflow issue when displaying the picker dialog with the keyboard open. |
69 | 194 | - Fixed an overflow issue when the device orientation is set to portrait mode. |
70 | | -- Fixed forward & back sliders button in RTL. |
| 195 | +- Fixed forward & back arrow buttons in RTL. |
71 | 196 |
|
72 | 197 | # 3.0.2 |
73 | 198 |
|
|
0 commit comments