toTextStyle method

TextStyle toTextStyle({
  1. Color? color,
  2. Color? backgroundColor,
  3. bool bold = false,
  4. bool italic = false,
  5. TextDecoration decoration = TextDecoration.none,
  6. Color? decorationColor,
  7. double? letterSpacing,
})

Implementation

TextStyle toTextStyle({
  Color? color,
  Color? backgroundColor,
  bool bold = false,
  bool italic = false,
  TextDecoration decoration = TextDecoration.none,
  Color? decorationColor,
  double? letterSpacing,
}) {
  return TextStyle(
    fontSize: fontSize,
    height: height,
    fontFamily: fontFamily,
    fontFamilyFallback: fontFamilyFallback,
    fontFeatures: fontFeatures,
    color: color,
    backgroundColor: backgroundColor,
    fontWeight: bold ? FontWeight.bold : FontWeight.normal,
    fontStyle: italic ? FontStyle.italic : FontStyle.normal,
    decoration: decoration,
    decorationColor: decorationColor ?? color,
    letterSpacing: letterSpacing,
    // Splits the leading evenly above and below rather than in proportion
    // to the font's own ascent, so a fallback glyph is not nudged off the
    // shared baseline by metrics the primary font never had.
    leadingDistribution: TextLeadingDistribution.even,
  );
}