copyWith method

  1. @useResult
FTypography copyWith({
  1. String? defaultFontFamily,
  2. TextStyle? xs,
  3. TextStyle? sm,
  4. TextStyle? base,
  5. TextStyle? lg,
  6. TextStyle? xl,
  7. TextStyle? xl2,
  8. TextStyle? xl3,
  9. TextStyle? xl4,
  10. TextStyle? xl5,
  11. TextStyle? xl6,
  12. TextStyle? xl7,
  13. TextStyle? xl8,
})

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

const typography = FTypography(
  defaultFontFamily: 'packages/forui/my-font',
  sm: TextStyle(fontSize: 10),
  base: TextStyle(fontSize: 20),
);

final copy = typography.copyWith(defaultFontFamily: 'packages/forui/another-font');

print(copy.defaultFontFamily); // 'packages/forui/another-font'
print(copy.sm.fontSize); // 10
print(copy.base.fontSize); // 20

Implementation

@useResult
FTypography copyWith({
  String? defaultFontFamily,
  TextStyle? xs,
  TextStyle? sm,
  TextStyle? base,
  TextStyle? lg,
  TextStyle? xl,
  TextStyle? xl2,
  TextStyle? xl3,
  TextStyle? xl4,
  TextStyle? xl5,
  TextStyle? xl6,
  TextStyle? xl7,
  TextStyle? xl8,
}) =>
    FTypography(
      defaultFontFamily: defaultFontFamily ?? this.defaultFontFamily,
      xs: xs ?? this.xs,
      sm: sm ?? this.sm,
      base: base ?? this.base,
      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,
    );