render method

void render(
  1. RenderOutput out,
  2. void content(
    1. FrameContext ctx
    )
)

Renders the complete frame with content.

content receives a FrameContext with helper methods for writing styled lines. The frame handles top, bottom, and hints automatically.

Example:

wf.render(out, (ctx) {
  ctx.gutterLine('${theme.accent}Name:${theme.reset} $name');
  ctx.gutterLine('${ctx.lb.checkbox(selected)} Toggle option');
});

Implementation

void render(
  RenderOutput out,
  void Function(FrameContext ctx) content,
) {
  final frame = FramedLayout(title, theme: theme);
  final lb = LineBuilder(theme);
  final ctx = FrameContext._(out, lb, theme, frame);

  // Top border
  ctx.writeTop();

  // Optional connector
  if (showConnector && features.showBorders) {
    out.writeln(frame.connector());
  }

  // Content callback
  content(ctx);

  // Bottom border
  if (features.showBorders) {
    out.writeln(frame.bottom());
  }

  // Hints
  if (bindings != null) {
    _writeHints(out, bindings!);
  }
}