copyWith method

ThemeData copyWith (
  1. {Brightness brightness,
  2. VisualDensity visualDensity,
  3. Color primaryColor,
  4. Brightness primaryColorBrightness,
  5. Color primaryColorLight,
  6. Color primaryColorDark,
  7. Color accentColor,
  8. Brightness accentColorBrightness,
  9. Color canvasColor,
  10. Color scaffoldBackgroundColor,
  11. Color bottomAppBarColor,
  12. Color cardColor,
  13. Color dividerColor,
  14. Color focusColor,
  15. Color hoverColor,
  16. Color highlightColor,
  17. Color splashColor,
  18. InteractiveInkFeatureFactory splashFactory,
  19. Color selectedRowColor,
  20. Color unselectedWidgetColor,
  21. Color disabledColor,
  22. ButtonThemeData buttonTheme,
  23. ToggleButtonsThemeData toggleButtonsTheme,
  24. Color buttonColor,
  25. Color secondaryHeaderColor,
  26. Color textSelectionColor,
  27. Color cursorColor,
  28. Color textSelectionHandleColor,
  29. Color backgroundColor,
  30. Color dialogBackgroundColor,
  31. Color indicatorColor,
  32. Color hintColor,
  33. Color errorColor,
  34. Color toggleableActiveColor,
  35. TextTheme textTheme,
  36. TextTheme primaryTextTheme,
  37. TextTheme accentTextTheme,
  38. InputDecorationTheme inputDecorationTheme,
  39. IconThemeData iconTheme,
  40. IconThemeData primaryIconTheme,
  41. IconThemeData accentIconTheme,
  42. SliderThemeData sliderTheme,
  43. TabBarTheme tabBarTheme,
  44. TooltipThemeData tooltipTheme,
  45. CardTheme cardTheme,
  46. ChipThemeData chipTheme,
  47. TargetPlatform platform,
  48. MaterialTapTargetSize materialTapTargetSize,
  49. bool applyElevationOverlayColor,
  50. PageTransitionsTheme pageTransitionsTheme,
  51. AppBarTheme appBarTheme,
  52. BottomAppBarTheme bottomAppBarTheme,
  53. ColorScheme colorScheme,
  54. DialogTheme dialogTheme,
  55. FloatingActionButtonThemeData floatingActionButtonTheme,
  56. NavigationRailThemeData navigationRailTheme,
  57. Typography typography,
  58. CupertinoThemeData cupertinoOverrideTheme,
  59. SnackBarThemeData snackBarTheme,
  60. BottomSheetThemeData bottomSheetTheme,
  61. PopupMenuThemeData popupMenuTheme,
  62. MaterialBannerThemeData bannerTheme,
  63. DividerThemeData dividerTheme,
  64. ButtonBarThemeData buttonBarTheme,
  65. BottomNavigationBarThemeData bottomNavigationBarTheme,
  66. TimePickerThemeData timePickerTheme,
  67. bool fixTextFieldOutlineLabel}
)

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

ThemeData copyWith({
  Brightness brightness,
  VisualDensity visualDensity,
  Color primaryColor,
  Brightness primaryColorBrightness,
  Color primaryColorLight,
  Color primaryColorDark,
  Color accentColor,
  Brightness accentColorBrightness,
  Color canvasColor,
  Color scaffoldBackgroundColor,
  Color bottomAppBarColor,
  Color cardColor,
  Color dividerColor,
  Color focusColor,
  Color hoverColor,
  Color highlightColor,
  Color splashColor,
  InteractiveInkFeatureFactory splashFactory,
  Color selectedRowColor,
  Color unselectedWidgetColor,
  Color disabledColor,
  ButtonThemeData buttonTheme,
  ToggleButtonsThemeData toggleButtonsTheme,
  Color buttonColor,
  Color secondaryHeaderColor,
  Color textSelectionColor,
  Color cursorColor,
  Color textSelectionHandleColor,
  Color backgroundColor,
  Color dialogBackgroundColor,
  Color indicatorColor,
  Color hintColor,
  Color errorColor,
  Color toggleableActiveColor,
  TextTheme textTheme,
  TextTheme primaryTextTheme,
  TextTheme accentTextTheme,
  InputDecorationTheme inputDecorationTheme,
  IconThemeData iconTheme,
  IconThemeData primaryIconTheme,
  IconThemeData accentIconTheme,
  SliderThemeData sliderTheme,
  TabBarTheme tabBarTheme,
  TooltipThemeData tooltipTheme,
  CardTheme cardTheme,
  ChipThemeData chipTheme,
  TargetPlatform platform,
  MaterialTapTargetSize materialTapTargetSize,
  bool applyElevationOverlayColor,
  PageTransitionsTheme pageTransitionsTheme,
  AppBarTheme appBarTheme,
  BottomAppBarTheme bottomAppBarTheme,
  ColorScheme colorScheme,
  DialogTheme dialogTheme,
  FloatingActionButtonThemeData floatingActionButtonTheme,
  NavigationRailThemeData navigationRailTheme,
  Typography typography,
  CupertinoThemeData cupertinoOverrideTheme,
  SnackBarThemeData snackBarTheme,
  BottomSheetThemeData bottomSheetTheme,
  PopupMenuThemeData popupMenuTheme,
  MaterialBannerThemeData bannerTheme,
  DividerThemeData dividerTheme,
  ButtonBarThemeData buttonBarTheme,
  BottomNavigationBarThemeData bottomNavigationBarTheme,
  TimePickerThemeData timePickerTheme,
  bool fixTextFieldOutlineLabel,
}) {
  cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
  return ThemeData.raw(
    visualDensity: visualDensity ?? this.visualDensity,
    primaryColor: primaryColor ?? this.primaryColor,
    primaryColorBrightness: primaryColorBrightness ?? this.primaryColorBrightness,
    primaryColorLight: primaryColorLight ?? this.primaryColorLight,
    primaryColorDark: primaryColorDark ?? this.primaryColorDark,
    accentColor: accentColor ?? this.accentColor,
    accentColorBrightness: accentColorBrightness ?? this.accentColorBrightness,
    canvasColor: canvasColor ?? this.canvasColor,
    scaffoldBackgroundColor: scaffoldBackgroundColor ?? this.scaffoldBackgroundColor,
    bottomAppBarColor: bottomAppBarColor ?? this.bottomAppBarColor,
    cardColor: cardColor ?? this.cardColor,
    dividerColor: dividerColor ?? this.dividerColor,
    focusColor: focusColor ?? this.focusColor,
    hoverColor: hoverColor ?? this.hoverColor,
    highlightColor: highlightColor ?? this.highlightColor,
    splashColor: splashColor ?? this.splashColor,
    splashFactory: splashFactory ?? this.splashFactory,
    selectedRowColor: selectedRowColor ?? this.selectedRowColor,
    unselectedWidgetColor: unselectedWidgetColor ?? this.unselectedWidgetColor,
    disabledColor: disabledColor ?? this.disabledColor,
    buttonColor: buttonColor ?? this.buttonColor,
    buttonTheme: buttonTheme ?? this.buttonTheme,
    toggleButtonsTheme: toggleButtonsTheme ?? this.toggleButtonsTheme,
    secondaryHeaderColor: secondaryHeaderColor ?? this.secondaryHeaderColor,
    textSelectionColor: textSelectionColor ?? this.textSelectionColor,
    cursorColor: cursorColor ?? this.cursorColor,
    textSelectionHandleColor: textSelectionHandleColor ?? this.textSelectionHandleColor,
    backgroundColor: backgroundColor ?? this.backgroundColor,
    dialogBackgroundColor: dialogBackgroundColor ?? this.dialogBackgroundColor,
    indicatorColor: indicatorColor ?? this.indicatorColor,
    hintColor: hintColor ?? this.hintColor,
    errorColor: errorColor ?? this.errorColor,
    toggleableActiveColor: toggleableActiveColor ?? this.toggleableActiveColor,
    textTheme: textTheme ?? this.textTheme,
    primaryTextTheme: primaryTextTheme ?? this.primaryTextTheme,
    accentTextTheme: accentTextTheme ?? this.accentTextTheme,
    inputDecorationTheme: inputDecorationTheme ?? this.inputDecorationTheme,
    iconTheme: iconTheme ?? this.iconTheme,
    primaryIconTheme: primaryIconTheme ?? this.primaryIconTheme,
    accentIconTheme: accentIconTheme ?? this.accentIconTheme,
    sliderTheme: sliderTheme ?? this.sliderTheme,
    tabBarTheme: tabBarTheme ?? this.tabBarTheme,
    tooltipTheme: tooltipTheme ?? this.tooltipTheme,
    cardTheme: cardTheme ?? this.cardTheme,
    chipTheme: chipTheme ?? this.chipTheme,
    platform: platform ?? this.platform,
    materialTapTargetSize: materialTapTargetSize ?? this.materialTapTargetSize,
    applyElevationOverlayColor: applyElevationOverlayColor ?? this.applyElevationOverlayColor,
    pageTransitionsTheme: pageTransitionsTheme ?? this.pageTransitionsTheme,
    appBarTheme: appBarTheme ?? this.appBarTheme,
    bottomAppBarTheme: bottomAppBarTheme ?? this.bottomAppBarTheme,
    colorScheme: (colorScheme ?? this.colorScheme).copyWith(brightness: brightness),
    dialogTheme: dialogTheme ?? this.dialogTheme,
    floatingActionButtonTheme: floatingActionButtonTheme ?? this.floatingActionButtonTheme,
    navigationRailTheme: navigationRailTheme ?? this.navigationRailTheme,
    typography: typography ?? this.typography,
    cupertinoOverrideTheme: cupertinoOverrideTheme ?? this.cupertinoOverrideTheme,
    snackBarTheme: snackBarTheme ?? this.snackBarTheme,
    bottomSheetTheme: bottomSheetTheme ?? this.bottomSheetTheme,
    popupMenuTheme: popupMenuTheme ?? this.popupMenuTheme,
    bannerTheme: bannerTheme ?? this.bannerTheme,
    dividerTheme: dividerTheme ?? this.dividerTheme,
    buttonBarTheme: buttonBarTheme ?? this.buttonBarTheme,
    bottomNavigationBarTheme: bottomNavigationBarTheme ?? this.bottomNavigationBarTheme,
    timePickerTheme: timePickerTheme ?? this.timePickerTheme,
    fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? this.fixTextFieldOutlineLabel,
  );
}