generateStrokeParagraph static method
dynamic
generateStrokeParagraph(
- DanmakuContentItem content,
- double danmakuWidth,
- double fontSize,
- int fontWeight,
Implementation
static generateStrokeParagraph(DanmakuContentItem content,
double danmakuWidth, double fontSize, int fontWeight) {
final Paint strokePaint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = 2
..color = Colors.black;
final ui.ParagraphBuilder strokeBuilder =
ui.ParagraphBuilder(ui.ParagraphStyle(
textAlign: TextAlign.left,
fontSize: fontSize,
fontWeight: FontWeight.values[fontWeight],
textDirection: TextDirection.ltr,
))
..pushStyle(ui.TextStyle(
foreground: strokePaint,
))
..addText(content.text);
return strokeBuilder.build()
..layout(ui.ParagraphConstraints(width: danmakuWidth));
}