paintSelf method

  1. @override
void paintSelf(
  1. Buffer buffer,
  2. Rect area
)
override

Implementation

@override
void paintSelf(Buffer buffer, Rect area) {
  final x = area.x;
  final y = area.y;
  final w = area.width;
  final h = area.height;
  if (w < 2 || h < 2) return;

  final activeStyle = _hasFocusedAncestor() ? focusedStyle : style;

  buffer.setString(x, y, '┌', activeStyle);
  buffer.setString(x + w - 1, y, '┐', activeStyle);
  buffer.setString(x, y + h - 1, '└', activeStyle);
  buffer.setString(x + w - 1, y + h - 1, '┘', activeStyle);

  for (var i = 1; i < w - 1; i++) {
    buffer.setString(x + i, y, '─', activeStyle);
    buffer.setString(x + i, y + h - 1, '─', activeStyle);
  }

  for (var i = 1; i < h - 1; i++) {
    buffer.setString(x, y + i, '│', activeStyle);
    buffer.setString(x + w - 1, y + i, '│', activeStyle);
  }
}