dayBackgroundColor property
final
Overrides the default color used to paint the background of the day labels in the grid of the date picker.
This supports different colors based on the WidgetStates of
the day button, such as WidgetState.selected
, WidgetState.hovered
,
WidgetState.focused
, and WidgetState.disabled
.
dayBackgroundColor: WidgetStateProperty.resolveWith((Set<WidgetState> states) {
if (states.contains(WidgetState.selected)) {
return Theme.of(context).colorScheme.primary;
}
return null; // Use the default color.
})
See also:
- dayOverlayColor which applies an overlay over the day labels depending on the WidgetState.
Implementation
final WidgetStateProperty<Color?>? dayBackgroundColor;