render method

  1. @override
void render(
  1. Terminal terminal
)
override

Render the panel and its contents. This should be called from within Layer.render.

Implementation

@override
void render(Terminal terminal) {
  super.render(terminal);

  var fColor = borderColor ?? terminal.foreground;
  var bColor = background ?? terminal.background;

  // draw the border
  // top & bottom
  for (var x = bounds.left + 1; x < bounds.right - 1; x++) {
    terminal.drawChar(
        x, bounds.top, _getBorderChar(_BorderChars.top, fColor, bColor));
    terminal.drawChar(x, bounds.bottom - 1,
        _getBorderChar(_BorderChars.bottom, fColor, bColor));
  }

  // left & right
  for (var y = bounds.top + 1; y < bounds.bottom - 1; y++) {
    terminal.drawChar(
        bounds.left, y, _getBorderChar(_BorderChars.left, fColor, bColor));
    terminal.drawChar(bounds.right - 1, y,
        _getBorderChar(_BorderChars.right, fColor, bColor));
  }

  // corners
  terminal.drawChar(bounds.topLeft.x, bounds.topLeft.y,
      _getBorderChar(_BorderChars.topLeft, fColor, bColor));
  terminal.drawChar(bounds.topRight.x - 1, bounds.topRight.y,
      _getBorderChar(_BorderChars.topRight, fColor, bColor));
  terminal.drawChar(bounds.bottomRight.x - 1, bounds.bottomRight.y - 1,
      _getBorderChar(_BorderChars.bottomRight, fColor, bColor));
  terminal.drawChar(bounds.bottomLeft.x, bounds.bottomLeft.y - 1,
      _getBorderChar(_BorderChars.bottomLeft, fColor, bColor));
}