dayPeriodColor property

Color? dayPeriodColor

The background color of the AM/PM toggle.

If dayPeriodColor is a MaterialStateColor, then the effective background color can depend on the MaterialState.selected state, i.e. if the segment is selected or not.

By default, if the segment is selected, the overall theme's ColorScheme.primary.withOpacity(0.12) is used when the overall theme's brightness is Brightness.light and ColorScheme.primary.withOpacity(0.24) is used when the overall theme's brightness is Brightness.dark. If the segment is not selected, Colors.transparent is used to allow the Dialog's color to be used.


Color? get dayPeriodColor {
  if (_dayPeriodColor == null || _dayPeriodColor is MaterialStateColor) {
    return _dayPeriodColor;
  return MaterialStateColor.resolveWith((Set<MaterialState> states) {
    if (states.contains(MaterialState.selected)) {
      return _dayPeriodColor;
    // The unselected day period should match the overall picker dialog color.
    // Making it transparent enables that without being redundant and allows
    // the optional elevation overlay for dark mode to be visible.
    return Colors.transparent;