paint method

void paint(
  1. Canvas canvas,
  2. TextGlyphs glyphs,
  3. Offset offset, {
  4. double opacity = 1,
})

Paints the text's layers in a box whose top-left corner is at offset, faded as one by opacity.

Implementation

void paint(ui.Canvas canvas, TextGlyphs glyphs, ui.Offset offset, {double opacity = 1}) {
  if (opacity <= 0) return;
  final ui.Rect bounds = _bounds.shift(offset);
  // A layer, rather than faded paints, so a fade reuses the laid-out letters.
  if (opacity < 1) canvas.saveLayer(bounds, fadePaint(opacity));
  if (_blurs.isEmpty) {
    _paintLayers(canvas, glyphs, offset);
  } else {
    paintLayerBlurred(canvas, _blurs, _box.shift(offset), bounds, () => _paintLayers(canvas, glyphs, offset));
  }
  if (opacity < 1) canvas.restore();
}