-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: date/time pickerDate or time picker widgetsDate or time picker widgetsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12Found to occur in 3.12frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- Set a Theme with datePickerTheme set.
- Set the values:
dayOverlayColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.hovered)) {
return Colors.blue;
}
return Colors.red;
}),
yearOverlayColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.hovered)) {
return Colors.blue;
} else if (states.contains(MaterialState.selected)) {
return Colors.yellow;
}
return Colors.red;
}),
- See that when you launch the date picker using showDatePicker() the year is using the dayOverlayColor on hover.
void selectDate(context) async {
DateTime? datePicked = (await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime(2000),
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly));
if (datePicked != null) {
setState(() {
datePicked = DateUtils.dateOnly(datePicked!);
selectedDate = datePicked!;
widget.onDatePicked(selectedDate);
});
}
}
- You could also just look at the code: https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/material/calendar_date_picker.dart#L1194
Expected results
DatePicker should use the YearOverlayColor from the theme data, not the day.
Also, the hover states for years seems to be inverse what it is for days, which causes a very strange UX / UI that doesn't look good:

Actual results
Uses dayOverlay instead of yearOverlay, making it difficult to style them independently.
Code sample
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[√] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Version 10.0.22621.1848], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.5)
[√] Android Studio (version 2022.1)
[√] Connected device (3 available)
[√] Network resources
• No issues found!Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: date/time pickerDate or time picker widgetsDate or time picker widgetsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12Found to occur in 3.12frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages team
Type
Projects
Status
Done (PR merged)