copyWith method

  1. @useResult
FColorScheme copyWith({
  1. Brightness? brightness,
  2. Color? background,
  3. Color? foreground,
  4. Color? primary,
  5. Color? primaryForeground,
  6. Color? secondary,
  7. Color? secondaryForeground,
  8. Color? muted,
  9. Color? mutedForeground,
  10. Color? destructive,
  11. Color? destructiveForeground,
  12. Color? error,
  13. Color? errorForeground,
  14. Color? border,
})

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? 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,
}) =>
    FColorScheme(
      brightness: brightness ?? this.brightness,
      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,
    );