copyWith method

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

Creates a copy of this theme but with the given fields replaced with the new values.

The brightness value is applied to the colorScheme.

Implementation

@override
ThemeData copyWith({
  MixedFluentTextTheme? fluentTextTheme,
  MixedFluentStrokeTheme? fluentStrokeTheme,
  MixedFluentShadowTheme? fluentShadowTheme,
  FluentStrokeThickness? fluentStrokeThickness,
  FluentColors? fluentBrandColors,
  // 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.

  // 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,
  Object? inputDecorationTheme,
  MaterialTapTargetSize? materialTapTargetSize,
  PageTransitionsTheme? pageTransitionsTheme,
  TargetPlatform? platform,
  ScrollbarThemeData? scrollbarTheme,
  InteractiveInkFeatureFactory? splashFactory,
  VisualDensity? visualDensity,
  // COLOR
  ColorScheme? colorScheme,
  Brightness? brightness,
  // [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,
  Color? scaffoldBackgroundColor,
  Color? secondaryHeaderColor,
  Color? shadowColor,
  Color? splashColor,
  Color? unselectedWidgetColor,
  // TYPOGRAPHY & ICONOGRAPHY
  IconThemeData? iconTheme,
  IconThemeData? primaryIconTheme,
  TextTheme? primaryTextTheme,
  TextTheme? textTheme,
  Typography? typography,
  // COMPONENT THEMES
  ActionIconThemeData? actionIconTheme,
  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 a ThemeData constructor (.from, .light, or .dark) instead. '
    'These constructors all have a useMaterial3 argument, '
    'and they set appropriate default values based on its value. '
    'See the useMaterial3 API documentation for full details. '
    'This feature was deprecated after v3.13.0-0.2.pre.',
  )
  bool? useMaterial3,
  @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,
}) {
  // TODO(QuncCccccc): 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',
      );
    }
  }

  // TODO(QuncCccccc): 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',
      );
    }
  }

  return Fluent2ThemeData.raw(
    fluentTextTheme: fluentTextTheme ?? this.fluentTextTheme,
    fluentStrokeTheme: fluentStrokeTheme ?? this.fluentStrokeTheme,
    fluentShadowTheme: fluentShadowTheme ?? this.fluentShadowTheme,
    fluentBrandColors: fluentBrandColors ?? this.fluentBrandColors,
    // 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: adaptations != null
        ? _createAdaptationMap(adaptations)
        : adaptationMap,
    applyElevationOverlayColor:
        applyElevationOverlayColor ?? this.applyElevationOverlayColor,
    // cupertinoOverrideTheme: cupertinoOverrideTheme ?? this.cupertinoOverrideTheme,
    extensions: (extensions != null)
        ? _themeExtensionIterableToMap(extensions)
        : this.extensions,
    inputDecorationTheme:
        inputDecorationTheme as InputDecorationThemeData? ??
        this.inputDecorationTheme,
    materialTapTargetSize:
        materialTapTargetSize ?? this.materialTapTargetSize,
    pageTransitionsTheme: pageTransitionsTheme ?? this.pageTransitionsTheme,
    platform: platform ?? this.platform,
    scrollbarTheme: scrollbarTheme ?? this.scrollbarTheme,
    splashFactory: splashFactory ?? this.splashFactory,
    // When deprecated useMaterial3 removed, maintain `this.useMaterial3` here
    // for == evaluation.
    useMaterial3: useMaterial3 ?? this.useMaterial3,
    visualDensity: visualDensity ?? this.visualDensity,
    // COLOR
    canvasColor: canvasColor ?? this.canvasColor,
    cardColor: cardColor ?? this.cardColor,
    colorScheme: (colorScheme ?? this.colorScheme).copyWith(
      brightness: brightness,
    ),
    dialogBackgroundColor:
        // ignore: deprecated_member_use
        dialogBackgroundColor ?? this.dialogBackgroundColor,
    disabledColor: disabledColor ?? this.disabledColor,
    dividerColor: dividerColor ?? this.dividerColor,
    focusColor: focusColor ?? this.focusColor,
    highlightColor: highlightColor ?? this.highlightColor,
    hintColor: hintColor ?? this.hintColor,
    hoverColor: hoverColor ?? this.hoverColor,
    // ignore: deprecated_member_use
    indicatorColor: indicatorColor ?? this.indicatorColor,
    primaryColor: primaryColor ?? this.primaryColor,
    primaryColorDark: primaryColorDark ?? this.primaryColorDark,
    primaryColorLight: primaryColorLight ?? this.primaryColorLight,
    scaffoldBackgroundColor:
        scaffoldBackgroundColor ?? this.scaffoldBackgroundColor,
    secondaryHeaderColor: secondaryHeaderColor ?? this.secondaryHeaderColor,
    shadowColor: shadowColor ?? this.shadowColor,
    splashColor: splashColor ?? this.splashColor,
    unselectedWidgetColor:
        unselectedWidgetColor ?? this.unselectedWidgetColor,
    // TYPOGRAPHY & ICONOGRAPHY
    iconTheme: iconTheme ?? this.iconTheme,
    primaryIconTheme: primaryIconTheme ?? this.primaryIconTheme,
    primaryTextTheme: primaryTextTheme ?? this.primaryTextTheme,
    textTheme: textTheme ?? this.textTheme,
    typography: typography ?? this.typography,
    // COMPONENT THEMES
    actionIconTheme: actionIconTheme ?? this.actionIconTheme,
    appBarTheme: appBarTheme as AppBarThemeData? ?? this.appBarTheme,
    badgeTheme: badgeTheme ?? this.badgeTheme,
    bannerTheme: bannerTheme ?? this.bannerTheme,
    bottomAppBarTheme: bottomAppBarTheme ?? this.bottomAppBarTheme,
    bottomNavigationBarTheme:
        bottomNavigationBarTheme ?? this.bottomNavigationBarTheme,
    bottomSheetTheme: bottomSheetTheme ?? this.bottomSheetTheme,
    // ignore: deprecated_member_use
    buttonBarTheme: buttonBarTheme ?? this.buttonBarTheme,
    buttonTheme: buttonTheme ?? this.buttonTheme,
    cardTheme: cardTheme ?? this.cardTheme,
    carouselViewTheme: carouselViewTheme ?? this.carouselViewTheme,
    checkboxTheme: checkboxTheme ?? this.checkboxTheme,
    chipTheme: chipTheme ?? this.chipTheme,
    dataTableTheme: dataTableTheme ?? this.dataTableTheme,
    datePickerTheme: datePickerTheme ?? this.datePickerTheme,
    dialogTheme: dialogTheme ?? this.dialogTheme,
    dividerTheme: dividerTheme ?? this.dividerTheme,
    drawerTheme: drawerTheme ?? this.drawerTheme,
    dropdownMenuTheme: dropdownMenuTheme ?? this.dropdownMenuTheme,
    elevatedButtonTheme: elevatedButtonTheme ?? this.elevatedButtonTheme,
    expansionTileTheme: expansionTileTheme ?? this.expansionTileTheme,
    filledButtonTheme: filledButtonTheme ?? this.filledButtonTheme,
    floatingActionButtonTheme:
        floatingActionButtonTheme ?? this.floatingActionButtonTheme,
    iconButtonTheme: iconButtonTheme ?? this.iconButtonTheme,
    listTileTheme: listTileTheme ?? this.listTileTheme,
    menuBarTheme: menuBarTheme ?? this.menuBarTheme,
    menuButtonTheme: menuButtonTheme ?? this.menuButtonTheme,
    menuTheme: menuTheme ?? this.menuTheme,
    navigationBarTheme: navigationBarTheme ?? this.navigationBarTheme,
    navigationDrawerTheme:
        navigationDrawerTheme ?? this.navigationDrawerTheme,
    navigationRailTheme: navigationRailTheme ?? this.navigationRailTheme,
    outlinedButtonTheme: outlinedButtonTheme ?? this.outlinedButtonTheme,
    popupMenuTheme: popupMenuTheme ?? this.popupMenuTheme,
    progressIndicatorTheme:
        progressIndicatorTheme ?? this.progressIndicatorTheme,
    radioTheme: radioTheme ?? this.radioTheme,
    searchBarTheme: searchBarTheme ?? this.searchBarTheme,
    searchViewTheme: searchViewTheme ?? this.searchViewTheme,
    segmentedButtonTheme: segmentedButtonTheme ?? this.segmentedButtonTheme,
    sliderTheme: sliderTheme ?? this.sliderTheme,
    snackBarTheme: snackBarTheme ?? this.snackBarTheme,
    switchTheme: switchTheme ?? this.switchTheme,
    tabBarTheme: tabBarTheme ?? this.tabBarTheme,
    textButtonTheme: textButtonTheme ?? this.textButtonTheme,
    textSelectionTheme: textSelectionTheme ?? this.textSelectionTheme,
    timePickerTheme: timePickerTheme ?? this.timePickerTheme,
    toggleButtonsTheme: toggleButtonsTheme ?? this.toggleButtonsTheme,
    tooltipTheme: tooltipTheme ?? this.tooltipTheme,
  );
}