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) {
  _cachedStyle ??=
      TextStyle(color: _color, backgroundColor: _backgroundColor);
  final TextStyle style = _cachedStyle!;
  context.buffer.writeStyled(offset.x, offset.y, frame, style);

  if (label != null && label!.isNotEmpty) {
    int cx = offset.x + 2;
    for (int i = 0; i < label!.length; i++) {
      final String ch = label![i];
      context.buffer.writeStyled(cx, offset.y, ch, style);
      cx += charWidth(ch.codeUnitAt(0));
    }
  }
}