draw method

  1. @override
void draw(
  1. Screen screen,
  2. Rectangle area
)

Draws this border around the given area.

Implementation

@override
void draw(Screen screen, Rectangle area) {
  for (var y = area.minY; y < area.maxY; y++) {
    for (var x = area.minX; x < area.maxX; x++) {
      Side side;
      if (y == area.minY && x == area.minX) {
        side = topLeft;
      } else if (y == area.minY && x == area.maxX - 1) {
        side = topRight;
      } else if (y == area.maxY - 1 && x == area.minX) {
        side = bottomLeft;
      } else if (y == area.maxY - 1 && x == area.maxX - 1) {
        side = bottomRight;
      } else if (y == area.minY) {
        side = top;
      } else if (y == area.maxY - 1) {
        side = bottom;
      } else if (x == area.minX) {
        side = left;
      } else if (x == area.maxX - 1) {
        side = right;
      } else {
        continue;
      }

      final cell = Cell.newCell(screen.widthMethod(), side.content)
        ..style = side.style
        ..link = side.link;
      screen.setCell(x, y, cell);
    }
  }
}