Skip to content

Box

Category: UI

Source: box.dart

Classes

Box

Immutable set of box-drawing characters for rectangular borders.

Inspired by Rich's Box class — pure data with rendering helpers. Separates character definitions (what to draw) from color (how to style).

Constructor

dart
const Box({
    required this.topLeft,
    required this.top,
    required this.topRight,
    required this.left,
    required this.right,
    required this.bottomLeft,
    required this.bottom,
    required this.bottomRight,
  })

Properties

PropertyTypeDescription
topRightString topLeft, top,
rightString left,
bottomRightString bottomLeft, bottom,
lightconstLight box-drawing: ┌─┐│└┘
heavyconstHeavy/double box-drawing: ╔═╗║╚╝
roundedconstRounded box-drawing: ╭─╮│╰╯

Methods

`List<String> renderFrame(
int width,
int height,
String title, {
String color = '\x1b[2m',

})`

Render a complete border frame: top line with title, empty interior rows, and bottom line. Returns [height] lines, each [width] visible columns.

[color] is the ANSI escape for the border characters (e.g. '\x1b[2m' for dim, '\x1b[33m' for yellow). Title is always yellow.

Released under the MIT License.