drawHighlight method
Implementation
void drawHighlight(LyricsLineModel model, Canvas canvas, TextPainter? painter,
Offset offset) {
if (!model.hasMain) return;
var tmpHighlightWidth = _highlightWidth;
model.drawInfo?.inlineDrawList.forEach((element) {
if (tmpHighlightWidth < 0) {
return;
}
var currentWidth = 0.0;
if (tmpHighlightWidth >= element.width) {
currentWidth = element.width;
} else {
currentWidth = element.width - (element.width - tmpHighlightWidth);
}
tmpHighlightWidth -= currentWidth;
var dx = offset.dx + element.offset.dx;
if (lyricUI.getHighlightDirection() == HighlightDirection.RTL) {
dx += element.width;
dx -= currentWidth;
}
canvas.drawRect(
Rect.fromLTWH(dx, offset.dy + element.offset.dy - 2, currentWidth,
element.height + 2),
lightBlendPaint..color = lyricUI.getLyricHightlightColor());
});
}