copyWith method
ThemeData
copyWith({
- ValueGetter<
ColorScheme> ? colorScheme, - ValueGetter<
double> ? radius, - ValueGetter<
Typography> ? typography, - ValueGetter<
TargetPlatform> ? platform, - ValueGetter<
double> ? scaling, - ValueGetter<
IconThemeProperties> ? iconTheme, - ValueGetter<
double> ? surfaceOpacity, - ValueGetter<
double> ? surfaceBlur, - ValueGetter<
bool?> ? enableFeedback, - ValueGetter<
Density> ? density,
Creates a copy of this theme with specified properties overridden.
All parameters are optional getters that provide new values when present.
Returns: ThemeData — a new theme with updated values.
Implementation
ThemeData copyWith({
ValueGetter<ColorScheme>? colorScheme,
ValueGetter<double>? radius,
ValueGetter<Typography>? typography,
ValueGetter<TargetPlatform>? platform,
ValueGetter<double>? scaling,
ValueGetter<IconThemeProperties>? iconTheme,
ValueGetter<double>? surfaceOpacity,
ValueGetter<double>? surfaceBlur,
ValueGetter<bool?>? enableFeedback,
ValueGetter<Density>? density,
}) {
return ThemeData(
colorScheme: colorScheme == null ? this.colorScheme : colorScheme(),
radius: radius == null ? this.radius : radius(),
typography: typography == null ? this.typography : typography(),
platform: platform == null ? _platform : platform(),
scaling: scaling == null ? this.scaling : scaling(),
iconTheme: iconTheme == null ? this.iconTheme : iconTheme(),
surfaceOpacity:
surfaceOpacity == null ? this.surfaceOpacity : surfaceOpacity(),
surfaceBlur: surfaceBlur == null ? this.surfaceBlur : surfaceBlur(),
enableFeedback:
enableFeedback == null ? this.enableFeedback : enableFeedback(),
density: density == null ? this.density : density(),
);
}