SfDateRangePickerThemeData constructor Null safety

SfDateRangePickerThemeData(
  1. {Brightness? brightness,
  2. Color? backgroundColor,
  3. Color? startRangeSelectionColor,
  4. Color? endRangeSelectionColor,
  5. Color? headerBackgroundColor,
  6. Color? viewHeaderBackgroundColor,
  7. Color? todayHighlightColor,
  8. Color? selectionColor,
  9. Color? rangeSelectionColor,
  10. Color? weekNumberBackgroundColor,
  11. TextStyle? viewHeaderTextStyle,
  12. TextStyle? headerTextStyle,
  13. TextStyle? trailingDatesTextStyle,
  14. TextStyle? leadingCellTextStyle,
  15. TextStyle? activeDatesTextStyle,
  16. TextStyle? cellTextStyle,
  17. TextStyle? rangeSelectionTextStyle,
  18. TextStyle? leadingDatesTextStyle,
  19. TextStyle? disabledDatesTextStyle,
  20. TextStyle? disabledCellTextStyle,
  21. TextStyle? selectionTextStyle,
  22. TextStyle? blackoutDatesTextStyle,
  23. TextStyle? todayTextStyle,
  24. TextStyle? todayCellTextStyle,
  25. TextStyle? weekendDatesTextStyle,
  26. TextStyle? specialDatesTextStyle,
  27. TextStyle? weekNumberTextStyle}
)

Create a SfDateRangePickerThemeData that's used to configure a SfDateRangePickerTheme.

Implementation

factory SfDateRangePickerThemeData({
  Brightness? brightness,
  Color? backgroundColor,
  Color? startRangeSelectionColor,
  Color? endRangeSelectionColor,
  Color? headerBackgroundColor,
  Color? viewHeaderBackgroundColor,
  Color? todayHighlightColor,
  Color? selectionColor,
  Color? rangeSelectionColor,
  Color? weekNumberBackgroundColor,
  TextStyle? viewHeaderTextStyle,
  TextStyle? headerTextStyle,
  TextStyle? trailingDatesTextStyle,
  TextStyle? leadingCellTextStyle,
  TextStyle? activeDatesTextStyle,
  TextStyle? cellTextStyle,
  TextStyle? rangeSelectionTextStyle,
  TextStyle? leadingDatesTextStyle,
  TextStyle? disabledDatesTextStyle,
  TextStyle? disabledCellTextStyle,
  TextStyle? selectionTextStyle,
  TextStyle? blackoutDatesTextStyle,
  TextStyle? todayTextStyle,
  TextStyle? todayCellTextStyle,
  TextStyle? weekendDatesTextStyle,
  TextStyle? specialDatesTextStyle,
  TextStyle? weekNumberTextStyle,
}) {
  brightness = brightness ?? Brightness.light;
  final bool isLight = brightness == Brightness.light;
  backgroundColor ??= Colors.transparent;
  headerBackgroundColor ??= Colors.transparent;
  viewHeaderBackgroundColor ??= Colors.transparent;
  weekNumberBackgroundColor = Colors.grey.withOpacity(0.19);
  viewHeaderTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.black87, fontSize: 11, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white, fontSize: 11, fontFamily: 'Roboto');
  headerTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.black87, fontSize: 16, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white, fontSize: 16, fontFamily: 'Roboto');
  trailingDatesTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.black54, fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white54, fontSize: 13, fontFamily: 'Roboto');
  leadingCellTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.black54, fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white54, fontSize: 13, fontFamily: 'Roboto');
  activeDatesTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.black87, fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white, fontSize: 13, fontFamily: 'Roboto');
  cellTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.black87, fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white, fontSize: 13, fontFamily: 'Roboto');
  leadingDatesTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.black54, fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white54, fontSize: 13, fontFamily: 'Roboto');
  rangeSelectionTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.black87, fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white, fontSize: 13, fontFamily: 'Roboto');
  disabledDatesTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.black26, fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white38, fontSize: 13, fontFamily: 'Roboto');
  disabledCellTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.black26, fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white38, fontSize: 13, fontFamily: 'Roboto');
  selectionTextStyle ??= isLight
      ? const TextStyle(
          color: Colors.white, fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.black, fontSize: 13, fontFamily: 'Roboto');
  todayTextStyle ??= isLight
      ? const TextStyle(fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(fontSize: 13, fontFamily: 'Roboto');
  todayCellTextStyle ??= isLight
      ? const TextStyle(fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(fontSize: 13, fontFamily: 'Roboto');
  specialDatesTextStyle ??= isLight
      ? const TextStyle(
          color: Color(0xFF339413), fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Color(0xFFEA75FF), fontSize: 13, fontFamily: 'Roboto');
  weekNumberTextStyle = isLight
      ? const TextStyle(
          color: Colors.black87, fontSize: 13, fontFamily: 'Roboto')
      : const TextStyle(
          color: Colors.white, fontSize: 13, fontFamily: 'Roboto');

  return SfDateRangePickerThemeData.raw(
      brightness: brightness,
      backgroundColor: backgroundColor,
      viewHeaderTextStyle: viewHeaderTextStyle,
      headerTextStyle: headerTextStyle,
      trailingDatesTextStyle: trailingDatesTextStyle,
      leadingCellTextStyle: leadingCellTextStyle,
      activeDatesTextStyle: activeDatesTextStyle,
      cellTextStyle: cellTextStyle,
      rangeSelectionTextStyle: rangeSelectionTextStyle,
      rangeSelectionColor: rangeSelectionColor,
      weekNumberBackgroundColor: weekNumberBackgroundColor,
      leadingDatesTextStyle: leadingDatesTextStyle,
      disabledDatesTextStyle: disabledDatesTextStyle,
      disabledCellTextStyle: disabledCellTextStyle,
      selectionColor: selectionColor,
      selectionTextStyle: selectionTextStyle,
      startRangeSelectionColor: startRangeSelectionColor,
      endRangeSelectionColor: endRangeSelectionColor,
      headerBackgroundColor: headerBackgroundColor,
      viewHeaderBackgroundColor: viewHeaderBackgroundColor,
      blackoutDatesTextStyle: blackoutDatesTextStyle,
      todayHighlightColor: todayHighlightColor,
      todayTextStyle: todayTextStyle,
      todayCellTextStyle: todayCellTextStyle,
      weekendDatesTextStyle: weekendDatesTextStyle,
      specialDatesTextStyle: specialDatesTextStyle,
      weekNumberTextStyle: weekNumberTextStyle);
}