Skip to content

PanelModal ​

Category: UI

Source: panel_modal.dart

Enums ​

PanelStyle ​

ValueDescription
tape
simple
heavy

BarrierStyle ​

ValueDescription
dim
obscure
none

Classes ​

sealed PanelSize ​

Methods ​

int resolve(int available) ​

PanelFixed ​

Constructor ​

dart
PanelFixed(this.size)

Properties ​

PropertyTypeDescription
sizeint

Methods ​

int resolve(int available) ​

PanelFluid ​

Constructor ​

dart
PanelFluid(this.maxPercent, this.minSize, {this.margin = 2})

Properties ​

PropertyTypeDescription
maxPercentdouble
minSizeint
marginint

Methods ​

int resolve(int available) ​

abstract PanelOverlay ​

Properties ​

PropertyTypeDescription
isCompletebool get
isCompletebool get

Methods ​

bool handleEvent(TerminalEvent event) ​
`List<String> render( ​
int termWidth,
int termHeight,
List&lt;String&gt; backgroundLines,

)`

void cancel() ​

PanelModal ​

Constructor ​

dart
PanelModal({
    required this.title,
    required List<String> lines,
    this.box = Box.light,
    this.borderColor = '\x1b[2m',
    this.barrier = BarrierStyle.dim,
    PanelSize? width,
    PanelSize? height,
    this.dismissable = true,
    this.selectable = false,
    this.onOpenInEditor,
    int initialIndex = 0,
  })
dart
PanelModal.responsive({
    required this.title,
    required this.linesBuilder,
    this.box = Box.light,
    this.borderColor = '\x1b[2m',
    this.barrier = BarrierStyle.dim,
    PanelSize? width,
    PanelSize? height,
    this.dismissable = true,
    this.selectable = false,
    this.onOpenInEditor,
    int initialIndex = 0,
  })

Properties ​

PropertyTypeDescription
titleString
boxBox
borderColorString
barrierBarrierStyle
dismissablebool
selectablebool
scrollOffsetint get
isCompletebool get
resultFuture&lt;void&gt; get
selectedIndexint get
selectionFuture&lt;int?&gt; get
scrollOffsetint get
isCompletebool get
resultFuture&lt;void&gt; get
selectedIndexint get
selectionFuture&lt;int?&gt; get

Methods ​

void dismiss() ​
void cancel() ​
bool handleEvent(TerminalEvent event) ​
`List<String> render( ​
int termWidth,
int termHeight,
List&lt;String&gt; backgroundLines,

)`

Functions ​

`List<String> renderBorder( ​

PanelStyle style, int width, int height, String title, )`

List&lt;String&gt; applyBarrier(BarrierStyle style, List&lt;String&gt; lines) ​

String applyBarrierStyle(BarrierStyle style, String text) ​

Style a single plain-text background slice for the given barrier [style]. Used by the floating panels when compositing overlay rows over a dimmed background.

String splicePageIndicator(String borderLine, int currentPage, int totalPages) ​

Splice a current/total page indicator into the bottom [borderLine] of a panel, right-aligned with a two-column gutter. Returns [borderLine] unchanged when there isn't room for the indicator.

`List<String> composeModal({ ​

required String title, required int panelW, required int panelH, required List<String> content, required List<String> background, required int termWidth, required int termHeight, })`

Paint [content] inside a simple bordered panel and center it over [background], returning a full [termHeight]-row frame.

The one-shot overlays (DeviceCodePanel, ApiKeyPromptPanel) use this instead of [PanelModal]: they own their own input loop and only need the frame. Interactive modals composite per-row via [spliceOverlayRow], which also restyles the barrier.

Released under the MIT License.