Mairon Lucas
dc7c2892d9
modify toggle mode style with DatePickerTheme (#164102)
- Add properties to DatePickerThemeData:
- `toggleModeStyle` allow customization on _DatePickerModeToggleButton
TextStyle;
- `toggleModeForegroundColor` allow changing the color of both button
and Icon with consistency;
- Compatible with existing code by the use of defaults;
- Adjust test to cover new properties
How to customize toggle mode style before:
```dart
showDatePicker(
context: context,
firstDate: DateTime(2025),
lastDate: DateTime(2026),
builder:
(context, child) => Theme(
data: ThemeData.light().copyWith(
textTheme: TextTheme(titleSmall: TextStyle(fontSize: 16)),
datePickerTheme: DatePickerThemeData(
dayStyle: TextStyle(fontSize: 12),
),
),
child: child!,
),
);
```
Now:
```dart
showDatePicker(
context: context,
firstDate: DateTime(2025),
lastDate: DateTime(2026),
builder:
(context, child) => DatePickerTheme(
data: DatePickerThemeData(
toggleModeStyle: TextStyle(fontSize: 16),
dayStyle: TextStyle(fontSize: 12),
),
child: child!,
),
);
```
Ref #163866
Ref #160591
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-04-11 19:38:16 +00:00
..
2025-03-14 17:50:20 +00:00
2025-01-22 21:52:11 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-01-24 21:33:27 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-04-02 21:28:56 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-04-02 21:28:56 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-03-05 21:27:21 +00:00
2025-04-02 21:28:56 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-01-14 05:13:41 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-04-02 22:00:19 +00:00
2024-12-19 20:06:21 +00:00
2025-04-02 22:00:19 +00:00
2025-04-11 19:38:16 +00:00
2025-04-02 21:28:56 +00:00
2025-02-06 18:40:25 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-03-19 05:40:18 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-24 07:07:51 +00:00
2025-04-09 19:43:19 +00:00
2024-12-19 20:06:21 +00:00
2025-03-19 20:33:15 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-04-02 21:28:56 +00:00
2025-01-22 21:52:11 +00:00
2025-03-14 17:50:20 +00:00
2025-02-13 08:33:12 +00:00
2025-01-24 21:33:27 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-01-24 21:33:27 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-01-24 21:33:27 +00:00
2025-03-14 17:50:20 +00:00
2025-01-24 21:33:27 +00:00
2024-12-19 20:06:21 +00:00
2025-01-22 21:52:11 +00:00
2025-04-02 22:00:19 +00:00
2025-04-10 20:52:15 +00:00
2025-04-09 04:47:20 +00:00
2025-04-09 04:47:20 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-02-03 23:55:03 +00:00
2024-12-19 20:06:21 +00:00
2025-01-24 21:33:27 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-04-02 21:28:56 +00:00
2025-03-14 17:50:20 +00:00
2025-04-02 21:28:56 +00:00
2025-03-13 08:02:36 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-04-02 21:27:07 +00:00
2025-03-17 17:00:05 +00:00
2024-12-19 20:06:21 +00:00
2025-04-03 00:33:58 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-02-20 07:48:23 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2025-04-10 18:30:06 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-04-02 21:28:56 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-04-04 21:15:12 +00:00
2025-03-14 17:50:20 +00:00
2025-03-18 21:01:16 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-02-28 02:30:37 +00:00
2025-03-14 17:50:20 +00:00
2025-04-10 18:30:06 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-01-15 11:23:41 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-01-14 05:13:41 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-03-24 16:53:04 +00:00
2025-04-10 07:11:24 +00:00
2025-03-24 16:53:04 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2025-02-21 18:40:05 +00:00
2025-03-26 19:25:07 +00:00
2025-03-14 17:50:20 +00:00
2025-03-31 18:46:44 +00:00
2025-03-14 17:50:20 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2025-02-06 21:26:08 +00:00
2025-02-06 21:26:08 +00:00
2025-03-17 17:00:05 +00:00
2025-03-17 17:00:05 +00:00
2024-12-19 20:06:21 +00:00
2025-03-14 17:50:20 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00
2024-12-19 20:06:21 +00:00