paint method
Draw itself and its children, according to the calculated
box.offset
Implementation
@override
void paint(Context context) {
super.paint(context);
TextStyle? currentStyle;
PdfColor? currentColor;
if (_mustClip) {
context.canvas
..saveContext()
..drawBox(box!)
..clipPath();
}
for (final decoration in _decorations) {
assert(() {
if (Document.debug && RichText.debug) {
decoration.debugPaint(context, textScaleFactor, box!, _spans);
}
return true;
}());
decoration.backgroundPaint(
context,
textScaleFactor,
box,
_spans,
);
}
for (final span in _spans.sublist(_context.spanStart, _context.spanEnd)) {
assert(() {
if (Document.debug && RichText.debug) {
span.debugPaint(context, textScaleFactor, box);
}
return true;
}());
if (span.style != currentStyle) {
currentStyle = span.style;
if (currentStyle.color != currentColor) {
currentColor = currentStyle.color;
context.canvas.setFillColor(currentColor);
}
}
span.paint(
context,
currentStyle!,
textScaleFactor,
PdfPoint(box!.left, box!.top),
);
}
for (final decoration in _decorations) {
decoration.foregroundPaint(
context,
textScaleFactor,
box,
_spans,
);
}
if (_mustClip) {
context.canvas.restoreContext();
}
}