drawBox method

void drawBox(
  1. int x,
  2. int y,
  3. int width,
  4. int height,
  5. BoxOptions options,
  6. Color borderColor,
  7. Color backgroundColor,
)

Draws a bordered rectangle with optional titles and fill.

options controls border characters, visible sides, titles, and fill.

Example:

// Simple bordered box
buffer.drawBox(10, 5, 25, 12,
    BoxOptions(),
    Color.white, Color.transparent);

// Dialog with title
buffer.drawBox(15, 8, 35, 18,
    BoxOptions(
        title: 'Confirm Action',
        titleAlignment: TextAlign.center,
        fill: true
    ), Color.cyan, Color.blue);

x and y must fit signed 32-bit values and width and height unsigned 32-bit values; violations throw a pre-invocation RangeError after the lifecycle check.

Implementation

void drawBox(
  int x,
  int y,
  int width,
  int height,
  BoxOptions options,
  Color borderColor,
  Color backgroundColor,
) {
  _checkValid();
  _checkSigned32Abi(x, 'x');
  _checkSigned32Abi(y, 'y');
  _checkUnsignedAbi(width, 0xFFFFFFFF, 'width');
  _checkUnsignedAbi(height, 0xFFFFFFFF, 'height');
  _bindings.bufferDrawBox(
    _ptr,
    x,
    y,
    width,
    height,
    options,
    borderColor,
    backgroundColor,
  );
}