copyWith method
- @useResult
- Brightness? brightness,
- Color? barrier,
- Color? background,
- Color? foreground,
- Color? primary,
- Color? primaryForeground,
- Color? secondary,
- Color? secondaryForeground,
- Color? muted,
- Color? mutedForeground,
- Color? destructive,
- Color? destructiveForeground,
- Color? error,
- Color? errorForeground,
- Color? border,
- double? enabledHoveredOpacity,
- double? disabledOpacity,
Returns a copy of this FColorScheme with the given properties replaced.
final scheme = FColorScheme(
brightness: Brightness.light,
background: Colors.blue,
// Other arguments omitted for brevity
);
final copy = scheme.copyWith(brightness: Brightness.dark);
print(copy.brightness); // Brightness.dark
print(copy.background); // Colors.blue
Implementation
@useResult
FColorScheme copyWith({
Brightness? brightness,
Color? barrier,
Color? background,
Color? foreground,
Color? primary,
Color? primaryForeground,
Color? secondary,
Color? secondaryForeground,
Color? muted,
Color? mutedForeground,
Color? destructive,
Color? destructiveForeground,
Color? error,
Color? errorForeground,
Color? border,
double? enabledHoveredOpacity,
double? disabledOpacity,
}) =>
FColorScheme(
brightness: brightness ?? this.brightness,
barrier: barrier ?? this.barrier,
background: background ?? this.background,
foreground: foreground ?? this.foreground,
primary: primary ?? this.primary,
primaryForeground: primaryForeground ?? this.primaryForeground,
secondary: secondary ?? this.secondary,
secondaryForeground: secondaryForeground ?? this.secondaryForeground,
muted: muted ?? this.muted,
mutedForeground: mutedForeground ?? this.mutedForeground,
destructive: destructive ?? this.destructive,
destructiveForeground: destructiveForeground ?? this.destructiveForeground,
error: error ?? this.error,
errorForeground: errorForeground ?? this.errorForeground,
border: border ?? this.border,
enabledHoveredOpacity: enabledHoveredOpacity ?? this.enabledHoveredOpacity,
disabledOpacity: disabledOpacity ?? this.disabledOpacity,
);