getTextStyle static method
TextStyle
getTextStyle(
- BuildContext context,
- TxtStyle style, {
- double? letterSpacing,
- Color? color,
- TextOverflow? overflow,
Implementation
static TextStyle getTextStyle(BuildContext context, TxtStyle style,
{double? letterSpacing, Color? color, TextOverflow? overflow}) {
double screenWidth = MediaQuery.of(context).size.width;
double divisor =
MediaQuery.of(context).orientation == Orientation.landscape ? 620 : 340;
double fontSizeMultiplier = screenWidth / divisor;
double adjustedFontSize =
_fontSizeMap[style]! * fontSizeMultiplier; // Non-null assertion used
return customTextStyle(
fontSize: adjustedFontSize,
fontWeight: _fontWeightMap[style]!,
letterSpacing: letterSpacing,
color:
color ?? Theme.of(context).textTheme.bodyLarge?.color ?? Colors.black,
overflow: overflow,
);
}