copyWith method
ThemeData
copyWith({
- MixedFluentTextTheme? fluentTextTheme,
- MixedFluentStrokeTheme? fluentStrokeTheme,
- MixedFluentShadowTheme? fluentShadowTheme,
- FluentStrokeThickness? fluentStrokeThickness,
- FluentColors? fluentBrandColors,
- Iterable<
Adaptation< ? adaptations,Object> > - bool? applyElevationOverlayColor,
- NoDefaultCupertinoThemeData? cupertinoOverrideTheme,
- Iterable<
ThemeExtension> ? extensions, - Object? inputDecorationTheme,
- MaterialTapTargetSize? materialTapTargetSize,
- PageTransitionsTheme? pageTransitionsTheme,
- TargetPlatform? platform,
- ScrollbarThemeData? scrollbarTheme,
- InteractiveInkFeatureFactory? splashFactory,
- VisualDensity? visualDensity,
- ColorScheme? colorScheme,
- Brightness? brightness,
- 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,
- IconThemeData? iconTheme,
- IconThemeData? primaryIconTheme,
- TextTheme? primaryTextTheme,
- TextTheme? textTheme,
- Typography? typography,
- ActionIconThemeData? actionIconTheme,
- Object? appBarTheme,
- BadgeThemeData? badgeTheme,
- MaterialBannerThemeData? bannerTheme,
- BottomAppBarThemeData? bottomAppBarTheme,
- 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,
- 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('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,
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,
);
}