medium8 method
TextStyle
medium8({
- Color? color,
- bool? isBold,
- String? fontFamily,
- String? pageName,
- TextDecoration? decoration,
- Color? backgroundColor,
- FontWeight fontWeight = FontWeight.normal,
- bool? isStatic,
Implementation
TextStyle medium8(
{Color? color,
bool? isBold,
String? fontFamily,
String? pageName,
TextDecoration? decoration,
Color? backgroundColor,
FontWeight fontWeight = FontWeight.normal,
bool? isStatic}) {
color ??= Get.find<AppColors>().textColor;
late double fontSize;
if ((isStatic == null &&
isStaticDefault == null &&
Get.find<AppSettings>().properties.screenMode ==
ScreenMode.mobile) ||
(isStatic == null && isStaticDefault == false) ||
isStatic == false) {
double ratio1 = pageName == null
? _sizeRatios["medium"]!
: getPageDynamicFonts(pageName, SizeType.medium);
double ratio2 = pageName == null
? _sizeRatios["large"]!
: getPageDynamicFonts(pageName, SizeType.large);
double dif = (ratio2 - ratio1);
if (dif > ratio1) {
dif = ratio1;
}
fontSize = calculateRatio(ratio1, dif, 8);
} else {
double fontSize1 = pageName == null
? _staticSizes["medium"]!
: getPageStaticFonts(pageName, SizeType.medium);
double fontSize2 = pageName == null
? _staticSizes["large"]!
: getPageStaticFonts(pageName, SizeType.large);
double dif = (fontSize2 - fontSize1);
if (dif > fontSize1) {
dif = fontSize1;
}
fontSize = calculateFontsize(fontSize1, dif, 8);
}
return GoogleFonts.getFont(
fontFamily ??
(pageName != null
? Get.find<PageManager>()
.getPageFontFamily(pageName, SizeType.medium)
: defaultFontFamily),
fontSize: fontSize,
color: color,
decoration: decoration,
backgroundColor: backgroundColor,
fontWeight: isBold == null
? fontWeight
: isBold
? FontWeight.bold
: FontWeight.normal);
}