generateParagraph static method

dynamic generateParagraph(
  1. DanmakuContentItem content,
  2. double danmakuWidth,
  3. double fontSize
)

Implementation

static generateParagraph(
    DanmakuContentItem content, double danmakuWidth, double fontSize) {
  final ui.ParagraphBuilder builder = ui.ParagraphBuilder(ui.ParagraphStyle(
    textAlign: TextAlign.left,
    fontSize: fontSize,
    textDirection: TextDirection.ltr,
  ))
    ..pushStyle(ui.TextStyle(
      color: content.color,
    ))
    ..addText(content.text);
  return builder.build()
    ..layout(ui.ParagraphConstraints(width: danmakuWidth));
}