paint method

  1. @override
void paint(
  1. PaintingContext context,
  2. Offset offset
)
override

Paints this render object into the given context at offset.

Implementation

@override
void paint(PaintingContext context, Offset offset) {
  for (int lineIndex = 0; lineIndex < _lines.length; lineIndex++) {
    final line = _lines[lineIndex];
    int x = offset.x;

    for (final run in line.runs) {
      for (int charIdx = 0; charIdx < run.text.length; charIdx++) {
        context.buffer.writeStyled(
          x + charIdx,
          offset.y + lineIndex,
          run.text[charIdx],
          run.style,
        );
      }
      x += run.text.length;
    }
  }
}