getTextPaint method

TextPainter getTextPaint(
  1. String? text,
  2. TextStyle style, {
  3. Size? size,
  4. TextPainter? linePaint,
})

获取文本高度

Implementation

TextPainter getTextPaint(String? text, TextStyle style,
    {Size? size, TextPainter? linePaint}) {
  if (text == null) text = "";
  if (linePaint == null) {
    linePaint = TextPainter(
      textDirection: TextDirection.ltr,
    );
  }
  linePaint.textAlign = lyricPaint.lyricUI.getLyricTextAligin();
  linePaint
    ..text = TextSpan(text: text, style: style)
    ..layout(maxWidth: (size ?? mSize).width);
  return linePaint;
}