Canvas compositing
Paint styled text blocks at arbitrary (x, y) positions with z-index layering. Higher zIndex draws on top of lower ones at overlapping cells — perfect for dashboards, HUDs and overlapping panels.
Install the package
Every component ships in the single dart_tui package.
$dart pub add dart_tui

final canvas = Canvas(72, 22);
canvas.paint(2, 2, leftPanel.render(content), zIndex: 1);
canvas.paint(38, 2, rightPanel.render(content), zIndex: 1);
canvas.paint(18, 14, bannerStyle.render(banner), zIndex: 2);
return newView(canvas.render());Canvas
| Property | Type | Description |
|---|---|---|
| Canvas(width, height) | — | Create a compositing surface of the given size. |
| paint(x, y, block, {zIndex}) | — | Draw a (possibly multi-line, styled) block at a position. |
| render() | — | Flatten all layers into a single styled string. |