render method

  1. @override
void render(
  1. CanvasBuffer buffer,
  2. Rect bounds
)
override

Renders the app by delegating to the layout engine and drawing each positioned child to the CanvasBuffer.

Implementation

@override
void render(CanvasBuffer buffer, Rect bounds) {
  final LayoutEngine engine = LayoutEngine(
    rootInstance: this,
    children: _childrenInstance,
    direction: direction,
    bounds: bounds,
  );

  final maxSize = Size(
    width: TerminalFunctions.hasTerminal
        ? TerminalFunctions.terminalWidth
        : 80,
    height: TerminalFunctions.hasTerminal
        ? TerminalFunctions.terminalHeight
        : 20,
  );

  final positionedItems = engine.compute(maxSize);
  _renderPositionedComponents(buffer, positionedItems);
}