fulfillWithTheme method

DatePickerStyles fulfillWithTheme(
  1. ThemeData theme
)

Return new DatePickerStyles object where fields with null values set with defaults from theme.

Implementation

DatePickerStyles fulfillWithTheme(ThemeData theme) {
  Color accentColor = theme.colorScheme.secondary;

  TextStyle? _displayedPeriodTitle =
      displayedPeriodTitle ?? theme.textTheme.subtitle1;
  TextStyle? _currentDateStyle = currentDateStyle ??
      theme.textTheme.bodyText1?.copyWith(color: theme.colorScheme.secondary);
  TextStyle? _disabledDateStyle = disabledDateStyle ??
      theme.textTheme.bodyText2?.copyWith(color: theme.disabledColor);
  TextStyle? _selectedDateStyle = selectedDateStyle ??
      theme.textTheme.bodyText1?.copyWith(
        color: theme.colorScheme.onSecondary,
      );

  TextStyle? _defaultDateTextStyle =
      defaultDateTextStyle ?? theme.textTheme.bodyText2;
  BoxDecoration _selectedSingleDateDecoration =
      selectedSingleDateDecoration ??
          BoxDecoration(
              color: accentColor,
              borderRadius: const BorderRadius.all(Radius.circular(10.0)));

  DayHeaderStyle? _dayHeaderStyle = dayHeaderStyle;
  if (dayHeaderStyleBuilder == null && _dayHeaderStyle == null) {
    _dayHeaderStyle = DayHeaderStyle(textStyle: theme.textTheme.caption);
  }

  return DatePickerStyles(
      disabledDateStyle: _disabledDateStyle,
      currentDateStyle: _currentDateStyle,
      displayedPeriodTitle: _displayedPeriodTitle,
      selectedDateStyle: _selectedDateStyle,
      selectedSingleDateDecoration: _selectedSingleDateDecoration,
      defaultDateTextStyle: _defaultDateTextStyle,
      dayHeaderStyle: _dayHeaderStyle,
      dayHeaderStyleBuilder: dayHeaderStyleBuilder,
      dayHeaderTitleBuilder: dayHeaderTitleBuilder,
      nextIcon: nextIcon,
      prevIcon: prevIcon);
}