Skip to content

Commit 39322ee

Browse files
committed
update example, readme, changelog, screenshots
1 parent 41e5e6a commit 39322ee

10 files changed

Lines changed: 852 additions & 176 deletions

File tree

1.png

-123 KB
Loading

2.png

-90 KB
Loading

3.png

-134 KB
Loading

4.png

-120 KB
Loading

5.png

-111 KB
Binary file not shown.

6.png

-173 KB
Binary file not shown.

CHANGELOG.md

Lines changed: 127 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,134 @@
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+
1126
# 6.0.0
2127

3128
- Revert removing `DeviceOrientationBuilder` in favor of rename it.
4129
- Fix semantic. fixes [#39](https://github.com/hasanmhallak/date_picker/issues/39)
5130
- 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.
7132

8133
# 5.0.0
9134

@@ -67,7 +192,7 @@ final date = await showDatePickerDialog(
67192

68193
- Fixed an overflow issue when displaying the picker dialog with the keyboard open.
69194
- 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.
71196

72197
# 3.0.2
73198

0 commit comments

Comments
 (0)