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 box with extensive customization options.

This creates bordered rectangles with optional titles, custom border characters, selective sides, and interior fills. Perfect for UI panels, dialogs, and structured layouts.

Example:

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

// Dialog with title
buffer.drawBox(15, 8, 35, 18,
    BoxOptions(
        sides: BorderSides.all(),
        title: 'Confirm Action',
        titleAlignment: TextAlignment.center,
        fill: true
    ), Color.cyan, Color.darkBlue);

Implementation

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