setTextSpanDrawInfo method

void setTextSpanDrawInfo(
  1. LyricUI ui,
  2. List<LyricSpanInfo> spanList,
  3. TextPainter painter
)

计算span宽度

Implementation

void setTextSpanDrawInfo(
    LyricUI ui, List<LyricSpanInfo> spanList, TextPainter painter) {
  painter.textAlign = lyricPaint.lyricUI.getLyricTextAligin();
  spanList.forEach((element) {
    painter
      ..text =
          TextSpan(text: element.raw, style: ui.getPlayingMainTextStyle())
      ..layout();
    element.drawHeight = painter.height;
    element.drawWidth = painter.width;
  });
}