copyWith method
ShadTextTheme
copyWith({
- TextStyle? h1Large,
- TextStyle? h1,
- TextStyle? h2,
- TextStyle? h3,
- TextStyle? h4,
- TextStyle? p,
- TextStyle? blockquote,
- TextStyle? table,
- TextStyle? list,
- TextStyle? lead,
- TextStyle? large,
- TextStyle? small,
- TextStyle? muted,
- String? family,
- String? package,
- GoogleFontBuilder? googleFontBuilder,
- Map<
String, TextStyle> ? custom,
Implementation
ShadTextTheme copyWith({
TextStyle? h1Large,
TextStyle? h1,
TextStyle? h2,
TextStyle? h3,
TextStyle? h4,
TextStyle? p,
TextStyle? blockquote,
TextStyle? table,
TextStyle? list,
TextStyle? lead,
TextStyle? large,
TextStyle? small,
TextStyle? muted,
String? family,
String? package,
GoogleFontBuilder? googleFontBuilder,
Map<String, TextStyle>? custom,
}) {
final baseFamily = family ?? this.family;
late final String effectiveFamily;
if (package != null && package.isNotEmpty) {
final alreadyPrefixed = baseFamily.startsWith('packages/');
effectiveFamily =
!alreadyPrefixed //
? 'packages/$package/$baseFamily'
: baseFamily;
} else {
effectiveFamily = baseFamily;
}
return ShadTextTheme.custom(
canMerge: canMerge,
h1Large: h1Large ?? this.h1Large,
h1: h1 ?? this.h1,
h2: h2 ?? this.h2,
h3: h3 ?? this.h3,
h4: h4 ?? this.h4,
p: p ?? this.p,
blockquote: blockquote ?? this.blockquote,
table: table ?? this.table,
list: list ?? this.list,
lead: lead ?? this.lead,
large: large ?? this.large,
small: small ?? this.small,
muted: muted ?? this.muted,
family: effectiveFamily,
googleFontBuilder: googleFontBuilder ?? this.googleFontBuilder,
custom: custom ?? this.custom,
);
}