toTextStyle method

TextStyle toTextStyle({
  1. required Size screenSize,
  2. required double parentFontSize,
  3. double constraintWidth = 100,
})

Implementation

TextStyle toTextStyle(
    {required Size screenSize,
    //required Size constraintSize,
    required double parentFontSize,
    double constraintWidth = 100}) {
  double fontSize = this
          .fontSize
          ?.toPX(constraint: parentFontSize, screenSize: screenSize) ??
      10;
  double? letterSpacing = this
      .letterSpacing
      ?.toPX(constraint: parentFontSize, screenSize: screenSize);
  double? wordSpacing = this
      .wordSpacing
      ?.toPX(constraint: parentFontSize, screenSize: screenSize);

  return TextStyle(
    color: color,
    backgroundColor: backgroundColor,
    fontFamily: fontFamily,
    fontSize: fontSize,
    fontWeight: fontWeight,
    fontStyle: fontStyle,
    letterSpacing: letterSpacing,
    wordSpacing: wordSpacing,
    height: height,
    decoration: decoration,
    decorationColor: decorationColor,
    decorationStyle: decorationStyle,
    decorationThickness: decorationThickness,
    shadows: shadows,
  );
}