toTextStyle method

TextStyle toTextStyle({
  1. PColor? color,
  2. num pixelRatio = 1,
})

Implementation

TextStyle toTextStyle({PColor? color, num pixelRatio = 1}) {
  var fontSize = size / pixelRatio;
  var fontFamily = family;
  var fontFamilyFallback = familyFallback ?? 'sans-serif';
  var fontWeight = bold ? FontWeight.bold : FontWeight.normal;
  var fontStyle = italic ? FontStyle.italic : FontStyle.normal;
  var fontColor = color?.asColor ?? Colors.black;

  return TextStyle(
      fontFamily: fontFamily,
      fontFamilyFallback: [fontFamilyFallback],
      fontSize: fontSize,
      fontWeight: fontWeight,
      fontStyle: fontStyle,
      color: fontColor);
}