datePickerThemeData static method
DatePickerThemeData
datePickerThemeData(
- Brightness brightness,
- Palette colors,
- TextTheme textTheme, [
- MonetShapes? shapes,
Implementation
static DatePickerThemeData datePickerThemeData(
Brightness brightness,
Palette colors,
TextTheme textTheme, [
MonetShapes? shapes,
]) {
shapes ??= _defaultShapes;
final background = WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.hovered)) {
return colors.textHovered;
} else if (states.contains(WidgetState.pressed)) {
return colors.textSplashed;
} else if (states.contains(WidgetState.selected)) {
return colors.color;
} else {
return Colors.transparent;
}
});
final foreground = WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
return colors.colorText;
} else {
return colors.backgroundText;
}
});
final fillText = WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.hovered)) {
return colors.fillHoveredText;
} else if (states.contains(WidgetState.pressed)) {
return colors.fillSplashedText;
} else if (states.contains(WidgetState.selected)) {
return colors.fillSplashedText;
} else {
return colors.fillText;
}
});
final shadowColor = _singleShadowColorFor(colors.background);
return DatePickerThemeData(
backgroundColor: colors.background,
elevation: null /* will match Dialog.elevation */,
shadowColor: shadowColor,
surfaceTintColor: colors.background,
shape: shapes.border(),
headerBackgroundColor: colors.color,
headerForegroundColor: colors.colorText,
headerHeadlineStyle: textTheme.headlineMedium,
headerHelpStyle: textTheme.headlineSmall,
weekdayStyle: textTheme.bodyLarge,
dayStyle: textTheme.bodySmall,
dayForegroundColor: foreground,
dayBackgroundColor: background,
dayOverlayColor: background,
todayForegroundColor: foreground,
todayBackgroundColor: background,
todayBorder: BorderSide(width: 2.0, color: colors.fill),
yearStyle: textTheme.headlineMedium,
yearBackgroundColor: background,
yearForegroundColor: foreground,
yearOverlayColor: background,
rangePickerBackgroundColor: colors.background,
rangePickerElevation: 0,
rangePickerShadowColor: shadowColor,
rangePickerSurfaceTintColor: colors.background,
rangePickerShape: shapes.border(),
rangePickerHeaderBackgroundColor: colors.color,
rangePickerHeaderForegroundColor: colors.colorText,
rangePickerHeaderHeadlineStyle: textTheme.headlineMedium,
rangePickerHeaderHelpStyle: textTheme.headlineSmall,
rangeSelectionBackgroundColor: colors.fill,
rangeSelectionOverlayColor: fillText,
dividerColor: Colors.transparent,
inputDecorationTheme: null, // if null, uses ThemeData's
);
}