getFontStyle method
TextStyle
getFontStyle({
- required double fontSize,
- FontWeight? fontWeight,
- Color? color,
- FontStyle? fontStyle,
- double? letterSpacing = 0,
- double? wordSpacing,
- double? height,
- String? fontFamily,
- TextDecoration? decoration,
Implementation
TextStyle getFontStyle({
required double fontSize,
FontWeight? fontWeight,
Color? color,
FontStyle? fontStyle,
double? letterSpacing = 0,
double? wordSpacing,
double? height,
String? fontFamily,
TextDecoration? decoration,
}) {
final resolvedFamily = fontFamily ?? UiFrameworkConfig.fontFamily;
if (UiFrameworkConfig.fontStyleBuilder != null) {
return UiFrameworkConfig.fontStyleBuilder!(
fontSize: fontSize,
fontWeight: fontWeight ?? FontWeight.w400,
color: color,
fontStyle: fontStyle,
letterSpacing: letterSpacing,
wordSpacing: wordSpacing,
height: height,
fontFamily: resolvedFamily,
decoration: decoration,
);
}
final base = TextStyle(
fontSize: fontSize,
fontWeight: fontWeight ?? FontWeight.w400,
color: color,
fontStyle: fontStyle,
letterSpacing: letterSpacing,
height: height,
decoration: decoration,
wordSpacing: wordSpacing,
);
if (resolvedFamily != null) {
return base.copyWith(fontFamily: resolvedFamily);
}
return GoogleFonts.poppins(textStyle: base);
}