copyWith method

  1. @override
  2. @useResult
FTypeface copyWith({
  1. TextStyle? xs3,
  2. TextStyle? xs2,
  3. TextStyle? xs,
  4. TextStyle? sm,
  5. TextStyle? md,
  6. TextStyle? lg,
  7. TextStyle? xl,
  8. TextStyle? xl2,
  9. TextStyle? xl3,
  10. TextStyle? xl4,
  11. TextStyle? xl5,
  12. TextStyle? xl6,
  13. TextStyle? xl7,
  14. TextStyle? xl8,
  15. Iterable<FScalableExtension>? extensions,
})
override

Returns a copy of this FTypeface with the given properties replaced.

To change the fontFamily or fontFamilyFallback, create a FTypeface via its constructors instead.

const typeface = FTypeface(
  sm: TextStyle(fontSize: 10),
  md: TextStyle(fontSize: 20),
);

final copy = typeface.copyWith(sm: TextStyle(fontSize: 12));

print(copy.sm.fontSize); // 12
print(copy.md.fontSize); // 20

Implementation

@override
@useResult
FTypeface copyWith({
  TextStyle? xs3,
  TextStyle? xs2,
  TextStyle? xs,
  TextStyle? sm,
  TextStyle? md,
  TextStyle? lg,
  TextStyle? xl,
  TextStyle? xl2,
  TextStyle? xl3,
  TextStyle? xl4,
  TextStyle? xl5,
  TextStyle? xl6,
  TextStyle? xl7,
  TextStyle? xl8,
  Iterable<FScalableExtension<dynamic>>? extensions,
}) => FTypeface(
  fontFamily: fontFamily,
  fontFamilyFallback: fontFamilyFallback,
  xs3: xs3 ?? this.xs3,
  xs2: xs2 ?? this.xs2,
  xs: xs ?? this.xs,
  sm: sm ?? this.sm,
  md: md ?? this.md,
  lg: lg ?? this.lg,
  xl: xl ?? this.xl,
  xl2: xl2 ?? this.xl2,
  xl3: xl3 ?? this.xl3,
  xl4: xl4 ?? this.xl4,
  xl5: xl5 ?? this.xl5,
  xl6: xl6 ?? this.xl6,
  xl7: xl7 ?? this.xl7,
  xl8: xl8 ?? this.xl8,
  extensions: extensions ?? _extensions.values,
);