nastaliq static method
Applies Nastaliq-safe line heights to every style in base.
fontFamily is applied to every style that does not already set one;
pass null to keep the ambient family. lineHeightMultiplier scales
each style's explicit height, or the font size when no height is set.
Implementation
static TextTheme nastaliq(
TextTheme base, {
String? fontFamily,
double lineHeightMultiplier = 2.0,
}) {
TextStyle? tune(TextStyle? style) {
if (style == null) return null;
final size = style.fontSize ?? 14;
final height = style.height != null
? style.height! * lineHeightMultiplier
: size * lineHeightMultiplier;
return style.copyWith(
fontFamily: fontFamily ?? style.fontFamily,
height: height,
);
}
return base.copyWith(
displayLarge: tune(base.displayLarge),
displayMedium: tune(base.displayMedium),
displaySmall: tune(base.displaySmall),
headlineLarge: tune(base.headlineLarge),
headlineMedium: tune(base.headlineMedium),
headlineSmall: tune(base.headlineSmall),
titleLarge: tune(base.titleLarge),
titleMedium: tune(base.titleMedium),
titleSmall: tune(base.titleSmall),
bodyLarge: tune(base.bodyLarge),
bodyMedium: tune(base.bodyMedium),
bodySmall: tune(base.bodySmall),
labelLarge: tune(base.labelLarge),
labelMedium: tune(base.labelMedium),
labelSmall: tune(base.labelSmall),
);
}