getTextStyle static method

TextStyle getTextStyle(
  1. BuildContext context,
  2. TxtStyle style, {
  3. double? letterSpacing,
  4. Color? color,
  5. 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,
  );
}