ThemeData constructor

ThemeData({
  1. Iterable<Adaptation<Object>>? adaptations,
  2. bool? applyElevationOverlayColor,
  3. NoDefaultCupertinoThemeData? cupertinoOverrideTheme,
  4. Iterable<ThemeExtension>? extensions,
  5. Object? inputDecorationTheme,
  6. MaterialTapTargetSize? materialTapTargetSize,
  7. PageTransitionsTheme? pageTransitionsTheme,
  8. TargetPlatform? platform,
  9. ScrollbarThemeData? scrollbarTheme,
  10. InteractiveInkFeatureFactory? splashFactory,
  11. bool? useMaterial3,
  12. bool? useSystemColors,
  13. VisualDensity? visualDensity,
  14. ColorScheme? colorScheme,
  15. Brightness? brightness,
  16. Color? colorSchemeSeed,
  17. Color? canvasColor,
  18. Color? cardColor,
  19. Color? disabledColor,
  20. Color? dividerColor,
  21. Color? focusColor,
  22. Color? highlightColor,
  23. Color? hintColor,
  24. Color? hoverColor,
  25. Color? primaryColor,
  26. Color? primaryColorDark,
  27. Color? primaryColorLight,
  28. MaterialColor? primarySwatch,
  29. Color? scaffoldBackgroundColor,
  30. Color? secondaryHeaderColor,
  31. Color? shadowColor,
  32. Color? splashColor,
  33. Color? unselectedWidgetColor,
  34. String? fontFamily,
  35. List<String>? fontFamilyFallback,
  36. String? package,
  37. IconThemeData? iconTheme,
  38. IconThemeData? primaryIconTheme,
  39. TextTheme? primaryTextTheme,
  40. TextTheme? textTheme,
  41. Typography? typography,
  42. ActionIconThemeData? actionIconTheme,
  43. Object? appBarTheme,
  44. BadgeThemeData? badgeTheme,
  45. MaterialBannerThemeData? bannerTheme,
  46. BottomAppBarThemeData? bottomAppBarTheme,
  47. BottomNavigationBarThemeData? bottomNavigationBarTheme,
  48. BottomSheetThemeData? bottomSheetTheme,
  49. ButtonThemeData? buttonTheme,
  50. CardThemeData? cardTheme,
  51. CarouselViewThemeData? carouselViewTheme,
  52. CheckboxThemeData? checkboxTheme,
  53. ChipThemeData? chipTheme,
  54. DataTableThemeData? dataTableTheme,
  55. DatePickerThemeData? datePickerTheme,
  56. DialogThemeData? dialogTheme,
  57. DividerThemeData? dividerTheme,
  58. DrawerThemeData? drawerTheme,
  59. DropdownMenuThemeData? dropdownMenuTheme,
  60. ElevatedButtonThemeData? elevatedButtonTheme,
  61. ExpansionTileThemeData? expansionTileTheme,
  62. FilledButtonThemeData? filledButtonTheme,
  63. FloatingActionButtonThemeData? floatingActionButtonTheme,
  64. IconButtonThemeData? iconButtonTheme,
  65. ListTileThemeData? listTileTheme,
  66. MenuBarThemeData? menuBarTheme,
  67. MenuButtonThemeData? menuButtonTheme,
  68. MenuThemeData? menuTheme,
  69. NavigationBarThemeData? navigationBarTheme,
  70. NavigationDrawerThemeData? navigationDrawerTheme,
  71. NavigationRailThemeData? navigationRailTheme,
  72. OutlinedButtonThemeData? outlinedButtonTheme,
  73. PopupMenuThemeData? popupMenuTheme,
  74. ProgressIndicatorThemeData? progressIndicatorTheme,
  75. RadioThemeData? radioTheme,
  76. SearchBarThemeData? searchBarTheme,
  77. SearchViewThemeData? searchViewTheme,
  78. SegmentedButtonThemeData? segmentedButtonTheme,
  79. SliderThemeData? sliderTheme,
  80. SnackBarThemeData? snackBarTheme,
  81. SwitchThemeData? switchTheme,
  82. TabBarThemeData? tabBarTheme,
  83. TextButtonThemeData? textButtonTheme,
  84. TextSelectionThemeData? textSelectionTheme,
  85. TimePickerThemeData? timePickerTheme,
  86. ToggleButtonsThemeData? toggleButtonsTheme,
  87. TooltipThemeData? tooltipTheme,
  88. @Deprecated('Use OverflowBar instead. ' 'This feature was deprecated after v3.21.0-10.0.pre.') ButtonBarThemeData? buttonBarTheme,
  89. @Deprecated('Use DialogThemeData.backgroundColor instead. ' 'This feature was deprecated after v3.27.0-0.1.pre.') Color? dialogBackgroundColor,
  90. @Deprecated('Use TabBarThemeData.indicatorColor instead. ' 'This feature was deprecated after v3.28.0-1.0.pre.') Color? indicatorColor,
})

Create a ThemeData that's used to configure a Theme.

The colorScheme and textTheme are used by the Material components to compute default values for visual properties. The API documentation for each component widget explains exactly how the defaults are computed.

When providing a ColorScheme, apps can either provide one directly with the colorScheme parameter, or have one generated for them by using the colorSchemeSeed and brightness parameters. A generated color scheme will be based on the tones of colorSchemeSeed and all of its contrasting color will meet accessibility guidelines for readability. (See ColorScheme.fromSeed for more details.)

If the app wants to customize a generated color scheme, it can use ColorScheme.fromSeed directly and then ColorScheme.copyWith on the result to override any colors that need to be replaced. The result of this can be used as the colorScheme directly.

For historical reasons, instead of using a colorSchemeSeed or colorScheme, you can provide either a primaryColor or primarySwatch to construct the colorScheme, but the results will not be as complete as when using generation from a seed color.

If colorSchemeSeed is non-null then colorScheme, primaryColor and primarySwatch must all be null.

The textTheme TextStyle colors are black if the color scheme's brightness is Brightness.light, and white for Brightness.dark.

To override the appearance of specific components, provide a component theme parameter like sliderTheme, toggleButtonsTheme, or bottomNavigationBarTheme.

When useSystemColors is true and the platform supports system colors, then the system colors will be used to override certain theme colors. The colorScheme, textTheme, elevatedButtonTheme, outlinedButtonTheme, textButtonTheme, filledButtonTheme, and floatingActionButtonTheme are overriden by the system colors.

See also:

Implementation

factory ThemeData({
  // For the sanity of the reader, make sure these properties are in the same
  // order in every place that they are separated by section comments (e.g.
  // GENERAL CONFIGURATION). Each section except for deprecations should be
  // alphabetical by symbol name.

  // GENERAL CONFIGURATION
  Iterable<Adaptation<Object>>? adaptations,
  bool? applyElevationOverlayColor,
  NoDefaultCupertinoThemeData? cupertinoOverrideTheme,
  Iterable<ThemeExtension<dynamic>>? extensions,
  // TODO(bleroux): Change the parameter type to InputDecorationThemeData.
  Object? inputDecorationTheme,
  MaterialTapTargetSize? materialTapTargetSize,
  PageTransitionsTheme? pageTransitionsTheme,
  TargetPlatform? platform,
  ScrollbarThemeData? scrollbarTheme,
  InteractiveInkFeatureFactory? splashFactory,
  bool? useMaterial3,
  bool? useSystemColors,
  VisualDensity? visualDensity,
  // COLOR
  ColorScheme? colorScheme,
  Brightness? brightness,
  Color? colorSchemeSeed,
  // [colorScheme] is the preferred way to configure colors. The [Color] properties
  // listed below (as well as primarySwatch) will gradually be phased out, see
  // https://github.com/flutter/flutter/issues/91772.
  Color? canvasColor,
  Color? cardColor,
  Color? disabledColor,
  Color? dividerColor,
  Color? focusColor,
  Color? highlightColor,
  Color? hintColor,
  Color? hoverColor,
  Color? primaryColor,
  Color? primaryColorDark,
  Color? primaryColorLight,
  MaterialColor? primarySwatch,
  Color? scaffoldBackgroundColor,
  Color? secondaryHeaderColor,
  Color? shadowColor,
  Color? splashColor,
  Color? unselectedWidgetColor,
  // TYPOGRAPHY & ICONOGRAPHY
  String? fontFamily,
  List<String>? fontFamilyFallback,
  String? package,
  IconThemeData? iconTheme,
  IconThemeData? primaryIconTheme,
  TextTheme? primaryTextTheme,
  TextTheme? textTheme,
  Typography? typography,
  // COMPONENT THEMES
  ActionIconThemeData? actionIconTheme,
  // TODO(huycozy): Change the parameter type to AppBarThemeData
  Object? appBarTheme,
  BadgeThemeData? badgeTheme,
  MaterialBannerThemeData? bannerTheme,
  BottomAppBarThemeData? bottomAppBarTheme,
  BottomNavigationBarThemeData? bottomNavigationBarTheme,
  BottomSheetThemeData? bottomSheetTheme,
  ButtonThemeData? buttonTheme,
  CardThemeData? cardTheme,
  CarouselViewThemeData? carouselViewTheme,
  CheckboxThemeData? checkboxTheme,
  ChipThemeData? chipTheme,
  DataTableThemeData? dataTableTheme,
  DatePickerThemeData? datePickerTheme,
  DialogThemeData? dialogTheme,
  DividerThemeData? dividerTheme,
  DrawerThemeData? drawerTheme,
  DropdownMenuThemeData? dropdownMenuTheme,
  ElevatedButtonThemeData? elevatedButtonTheme,
  ExpansionTileThemeData? expansionTileTheme,
  FilledButtonThemeData? filledButtonTheme,
  FloatingActionButtonThemeData? floatingActionButtonTheme,
  IconButtonThemeData? iconButtonTheme,
  ListTileThemeData? listTileTheme,
  MenuBarThemeData? menuBarTheme,
  MenuButtonThemeData? menuButtonTheme,
  MenuThemeData? menuTheme,
  NavigationBarThemeData? navigationBarTheme,
  NavigationDrawerThemeData? navigationDrawerTheme,
  NavigationRailThemeData? navigationRailTheme,
  OutlinedButtonThemeData? outlinedButtonTheme,
  PopupMenuThemeData? popupMenuTheme,
  ProgressIndicatorThemeData? progressIndicatorTheme,
  RadioThemeData? radioTheme,
  SearchBarThemeData? searchBarTheme,
  SearchViewThemeData? searchViewTheme,
  SegmentedButtonThemeData? segmentedButtonTheme,
  SliderThemeData? sliderTheme,
  SnackBarThemeData? snackBarTheme,
  SwitchThemeData? switchTheme,
  TabBarThemeData? tabBarTheme,
  TextButtonThemeData? textButtonTheme,
  TextSelectionThemeData? textSelectionTheme,
  TimePickerThemeData? timePickerTheme,
  ToggleButtonsThemeData? toggleButtonsTheme,
  TooltipThemeData? tooltipTheme,
  // DEPRECATED (newest deprecations at the bottom)
  @Deprecated(
    'Use OverflowBar instead. '
    'This feature was deprecated after v3.21.0-10.0.pre.',
  )
  ButtonBarThemeData? buttonBarTheme,
  @Deprecated(
    'Use DialogThemeData.backgroundColor instead. '
    'This feature was deprecated after v3.27.0-0.1.pre.',
  )
  Color? dialogBackgroundColor,
  @Deprecated(
    'Use TabBarThemeData.indicatorColor instead. '
    'This feature was deprecated after v3.28.0-1.0.pre.',
  )
  Color? indicatorColor,
}) {
  // GENERAL CONFIGURATION
  cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
  extensions ??= <ThemeExtension<dynamic>>[];
  adaptations ??= <Adaptation<Object>>[];
  // TODO(bleroux): Clean this up once the type of `inputDecorationTheme` is changed to `InputDecorationThemeData`
  if (inputDecorationTheme != null) {
    if (inputDecorationTheme is InputDecorationTheme) {
      inputDecorationTheme = inputDecorationTheme.data;
    } else if (inputDecorationTheme is! InputDecorationThemeData) {
      throw ArgumentError(
        'inputDecorationTheme must be either a InputDecorationThemeData or a InputDecorationTheme',
      );
    }
  }
  inputDecorationTheme ??= const InputDecorationThemeData();
  platform ??= defaultTargetPlatform;
  switch (platform) {
    case TargetPlatform.android:
    case TargetPlatform.fuchsia:
    case TargetPlatform.iOS:
      materialTapTargetSize ??= MaterialTapTargetSize.padded;
    case TargetPlatform.linux:
    case TargetPlatform.macOS:
    case TargetPlatform.windows:
      materialTapTargetSize ??= MaterialTapTargetSize.shrinkWrap;
  }
  pageTransitionsTheme ??= const PageTransitionsTheme();
  scrollbarTheme ??= const ScrollbarThemeData();
  visualDensity ??= VisualDensity.defaultDensityForPlatform(platform);
  useMaterial3 ??= true;
  useSystemColors ??= false;
  final bool useInkSparkle = platform == TargetPlatform.android && !kIsWeb;
  splashFactory ??= useMaterial3
      ? useInkSparkle
            ? InkSparkle.splashFactory
            : InkRipple.splashFactory
      : InkSplash.splashFactory;

  // COLOR
  assert(
    colorScheme?.brightness == null ||
        brightness == null ||
        colorScheme!.brightness == brightness,
    'ThemeData.brightness does not match ColorScheme.brightness. '
    'Either override ColorScheme.brightness or ThemeData.brightness to '
    'match the other.',
  );
  assert(colorSchemeSeed == null || colorScheme == null);
  assert(colorSchemeSeed == null || primarySwatch == null);
  assert(colorSchemeSeed == null || primaryColor == null);
  final Brightness effectiveBrightness =
      brightness ?? colorScheme?.brightness ?? Brightness.light;
  final bool isDark = effectiveBrightness == Brightness.dark;
  if (colorSchemeSeed != null || useMaterial3) {
    if (colorSchemeSeed != null) {
      colorScheme = ColorScheme.fromSeed(
        seedColor: colorSchemeSeed,
        brightness: effectiveBrightness,
      );
    }
    colorScheme ??= isDark ? _colorSchemeDarkM3 : _colorSchemeLightM3;

    // For surfaces that use primary color in light themes and surface color in dark
    final Color primarySurfaceColor = isDark ? colorScheme.surface : colorScheme.primary;
    final Color onPrimarySurfaceColor = isDark ? colorScheme.onSurface : colorScheme.onPrimary;

    // Default some of the color settings to values from the color scheme
    primaryColor ??= primarySurfaceColor;
    canvasColor ??= colorScheme.surface;
    scaffoldBackgroundColor ??= colorScheme.surface;
    cardColor ??= colorScheme.surface;
    dividerColor ??= colorScheme.outline;
    dialogBackgroundColor ??= colorScheme.surface;
    indicatorColor ??= onPrimarySurfaceColor;
    applyElevationOverlayColor ??= brightness == Brightness.dark;
  }
  applyElevationOverlayColor ??= false;
  primarySwatch ??= Colors.blue;
  primaryColor ??= isDark ? Colors.grey[900]! : primarySwatch;
  final Brightness estimatedPrimaryColorBrightness = estimateBrightnessForColor(primaryColor);
  primaryColorLight ??= isDark ? Colors.grey[500]! : primarySwatch[100]!;
  primaryColorDark ??= isDark ? Colors.black : primarySwatch[700]!;
  final bool primaryIsDark = estimatedPrimaryColorBrightness == Brightness.dark;
  focusColor ??= isDark ? Colors.white.withOpacity(0.12) : Colors.black.withOpacity(0.12);
  hoverColor ??= isDark ? Colors.white.withOpacity(0.04) : Colors.black.withOpacity(0.04);
  shadowColor ??= Colors.black;
  canvasColor ??= isDark ? Colors.grey[850]! : Colors.grey[50]!;
  scaffoldBackgroundColor ??= canvasColor;
  cardColor ??= isDark ? Colors.grey[800]! : Colors.white;
  dividerColor ??= isDark ? const Color(0x1FFFFFFF) : const Color(0x1F000000);
  // Create a ColorScheme that is backwards compatible as possible
  // with the existing default ThemeData color values.
  colorScheme ??= ColorScheme.fromSwatch(
    primarySwatch: primarySwatch,
    accentColor: isDark ? Colors.tealAccent[200]! : primarySwatch[500]!,
    cardColor: cardColor,
    backgroundColor: isDark ? Colors.grey[700]! : primarySwatch[200]!,
    errorColor: Colors.red[700],
    brightness: effectiveBrightness,
  );
  unselectedWidgetColor ??= isDark ? Colors.white70 : Colors.black54;
  // Spec doesn't specify a dark theme secondaryHeaderColor, this is a guess.
  secondaryHeaderColor ??= isDark ? Colors.grey[700]! : primarySwatch[50]!;
  hintColor ??= isDark ? Colors.white60 : Colors.black.withOpacity(0.6);
  // The default [buttonTheme] is here because it doesn't use the defaults for
  // [disabledColor], [highlightColor], and [splashColor].
  buttonTheme ??= ButtonThemeData(
    colorScheme: colorScheme,
    buttonColor: isDark ? primarySwatch[600]! : Colors.grey[300]!,
    disabledColor: disabledColor,
    focusColor: focusColor,
    hoverColor: hoverColor,
    highlightColor: highlightColor,
    splashColor: splashColor,
    materialTapTargetSize: materialTapTargetSize,
  );
  disabledColor ??= isDark ? Colors.white38 : Colors.black38;
  highlightColor ??= isDark ? const Color(0x40CCCCCC) : const Color(0x66BCBCBC);
  splashColor ??= isDark ? const Color(0x40CCCCCC) : const Color(0x66C8C8C8);

  // TYPOGRAPHY & ICONOGRAPHY
  typography ??= useMaterial3
      ? Typography.material2021(platform: platform, colorScheme: colorScheme)
      : Typography.material2014(platform: platform);
  TextTheme defaultTextTheme = isDark ? typography.white : typography.black;
  TextTheme defaultPrimaryTextTheme = primaryIsDark ? typography.white : typography.black;
  if (fontFamily != null) {
    defaultTextTheme = defaultTextTheme.apply(fontFamily: fontFamily);
    defaultPrimaryTextTheme = defaultPrimaryTextTheme.apply(fontFamily: fontFamily);
  }
  if (fontFamilyFallback != null) {
    defaultTextTheme = defaultTextTheme.apply(fontFamilyFallback: fontFamilyFallback);
    defaultPrimaryTextTheme = defaultPrimaryTextTheme.apply(
      fontFamilyFallback: fontFamilyFallback,
    );
  }
  if (package != null) {
    defaultTextTheme = defaultTextTheme.apply(package: package);
    defaultPrimaryTextTheme = defaultPrimaryTextTheme.apply(package: package);
  }
  textTheme = defaultTextTheme.merge(textTheme);
  primaryTextTheme = defaultPrimaryTextTheme.merge(primaryTextTheme);
  iconTheme ??= isDark
      ? IconThemeData(color: kDefaultIconLightColor)
      : IconThemeData(color: kDefaultIconDarkColor);
  primaryIconTheme ??= primaryIsDark
      ? const IconThemeData(color: Colors.white)
      : const IconThemeData(color: Colors.black);

  // COMPONENT THEMES
  // TODO(huycozy): Clean this up once the type of `appBarTheme` is changed to `appBarThemeData`
  if (appBarTheme != null) {
    if (appBarTheme is AppBarTheme) {
      appBarTheme = appBarTheme.data;
    } else if (appBarTheme is! AppBarThemeData) {
      throw ArgumentError('appBarTheme must be either a AppBarThemeData or a AppBarTheme');
    }
  }
  badgeTheme ??= const BadgeThemeData();
  bannerTheme ??= const MaterialBannerThemeData();
  bottomAppBarTheme ??= const BottomAppBarThemeData();
  bottomNavigationBarTheme ??= const BottomNavigationBarThemeData();
  bottomSheetTheme ??= const BottomSheetThemeData();
  cardTheme ??= const CardThemeData();
  carouselViewTheme ??= const CarouselViewThemeData();
  checkboxTheme ??= const CheckboxThemeData();
  chipTheme ??= const ChipThemeData();
  dataTableTheme ??= const DataTableThemeData();
  datePickerTheme ??= const DatePickerThemeData();
  dialogTheme ??= const DialogThemeData();
  dividerTheme ??= const DividerThemeData();
  drawerTheme ??= const DrawerThemeData();
  dropdownMenuTheme ??= const DropdownMenuThemeData();
  elevatedButtonTheme ??= const ElevatedButtonThemeData();
  expansionTileTheme ??= const ExpansionTileThemeData();
  filledButtonTheme ??= const FilledButtonThemeData();
  floatingActionButtonTheme ??= const FloatingActionButtonThemeData();
  iconButtonTheme ??= const IconButtonThemeData();
  listTileTheme ??= const ListTileThemeData();
  menuBarTheme ??= const MenuBarThemeData();
  menuButtonTheme ??= const MenuButtonThemeData();
  menuTheme ??= const MenuThemeData();
  navigationBarTheme ??= const NavigationBarThemeData();
  navigationDrawerTheme ??= const NavigationDrawerThemeData();
  navigationRailTheme ??= const NavigationRailThemeData();
  outlinedButtonTheme ??= const OutlinedButtonThemeData();
  popupMenuTheme ??= const PopupMenuThemeData();
  progressIndicatorTheme ??= const ProgressIndicatorThemeData();
  radioTheme ??= const RadioThemeData();
  searchBarTheme ??= const SearchBarThemeData();
  searchViewTheme ??= const SearchViewThemeData();
  segmentedButtonTheme ??= const SegmentedButtonThemeData();
  sliderTheme ??= const SliderThemeData();
  snackBarTheme ??= const SnackBarThemeData();
  switchTheme ??= const SwitchThemeData();
  tabBarTheme ??= const TabBarThemeData();
  textButtonTheme ??= const TextButtonThemeData();
  textSelectionTheme ??= const TextSelectionThemeData();
  timePickerTheme ??= const TimePickerThemeData();
  toggleButtonsTheme ??= const ToggleButtonsThemeData();
  tooltipTheme ??= const TooltipThemeData();
  // DEPRECATED (newest deprecations at the bottom)
  buttonBarTheme ??= const ButtonBarThemeData();
  dialogBackgroundColor ??= isDark ? Colors.grey[800]! : Colors.white;
  indicatorColor ??= colorScheme.secondary == primaryColor ? Colors.white : colorScheme.secondary;

  ThemeData theme = ThemeData.raw(
    // For the sanity of the reader, make sure these properties are in the same
    // order in every place that they are separated by section comments (e.g.
    // GENERAL CONFIGURATION). Each section except for deprecations should be
    // alphabetical by symbol name.

    // GENERAL CONFIGURATION
    adaptationMap: _createAdaptationMap(adaptations),
    applyElevationOverlayColor: applyElevationOverlayColor,
    cupertinoOverrideTheme: cupertinoOverrideTheme,
    extensions: _themeExtensionIterableToMap(extensions),
    inputDecorationTheme: inputDecorationTheme as InputDecorationThemeData,
    materialTapTargetSize: materialTapTargetSize,
    pageTransitionsTheme: pageTransitionsTheme,
    platform: platform,
    scrollbarTheme: scrollbarTheme,
    splashFactory: splashFactory,
    useMaterial3: useMaterial3,
    visualDensity: visualDensity,
    // COLOR
    canvasColor: canvasColor,
    cardColor: cardColor,
    colorScheme: colorScheme,
    disabledColor: disabledColor,
    dividerColor: dividerColor,
    focusColor: focusColor,
    highlightColor: highlightColor,
    hintColor: hintColor,
    hoverColor: hoverColor,
    primaryColor: primaryColor,
    primaryColorDark: primaryColorDark,
    primaryColorLight: primaryColorLight,
    scaffoldBackgroundColor: scaffoldBackgroundColor,
    secondaryHeaderColor: secondaryHeaderColor,
    shadowColor: shadowColor,
    splashColor: splashColor,
    unselectedWidgetColor: unselectedWidgetColor,
    // TYPOGRAPHY & ICONOGRAPHY
    iconTheme: iconTheme,
    primaryTextTheme: primaryTextTheme,
    textTheme: textTheme,
    typography: typography,
    primaryIconTheme: primaryIconTheme,
    // COMPONENT THEMES
    actionIconTheme: actionIconTheme,
    // TODO(huycozy): Remove this type cast when appBarTheme is explicitly set to appBarThemeData
    appBarTheme: (appBarTheme as AppBarThemeData?) ?? const AppBarThemeData(),
    badgeTheme: badgeTheme,
    bannerTheme: bannerTheme,
    bottomAppBarTheme: bottomAppBarTheme,
    bottomNavigationBarTheme: bottomNavigationBarTheme,
    bottomSheetTheme: bottomSheetTheme,
    buttonTheme: buttonTheme,
    cardTheme: cardTheme,
    carouselViewTheme: carouselViewTheme,
    checkboxTheme: checkboxTheme,
    chipTheme: chipTheme,
    dataTableTheme: dataTableTheme,
    datePickerTheme: datePickerTheme,
    dialogTheme: dialogTheme,
    dividerTheme: dividerTheme,
    drawerTheme: drawerTheme,
    dropdownMenuTheme: dropdownMenuTheme,
    elevatedButtonTheme: elevatedButtonTheme,
    expansionTileTheme: expansionTileTheme,
    filledButtonTheme: filledButtonTheme,
    floatingActionButtonTheme: floatingActionButtonTheme,
    iconButtonTheme: iconButtonTheme,
    listTileTheme: listTileTheme,
    menuBarTheme: menuBarTheme,
    menuButtonTheme: menuButtonTheme,
    menuTheme: menuTheme,
    navigationBarTheme: navigationBarTheme,
    navigationDrawerTheme: navigationDrawerTheme,
    navigationRailTheme: navigationRailTheme,
    outlinedButtonTheme: outlinedButtonTheme,
    popupMenuTheme: popupMenuTheme,
    progressIndicatorTheme: progressIndicatorTheme,
    radioTheme: radioTheme,
    searchBarTheme: searchBarTheme,
    searchViewTheme: searchViewTheme,
    segmentedButtonTheme: segmentedButtonTheme,
    sliderTheme: sliderTheme,
    snackBarTheme: snackBarTheme,
    switchTheme: switchTheme,
    tabBarTheme: tabBarTheme,
    textButtonTheme: textButtonTheme,
    textSelectionTheme: textSelectionTheme,
    timePickerTheme: timePickerTheme,
    toggleButtonsTheme: toggleButtonsTheme,
    tooltipTheme: tooltipTheme,
    // DEPRECATED (newest deprecations at the bottom)
    buttonBarTheme: buttonBarTheme,
    dialogBackgroundColor: dialogBackgroundColor,
    indicatorColor: indicatorColor,
  );

  if (useSystemColors) {
    theme = theme._overrideWithSystemColors();
  }
  return theme;
}