Modal
Category: UI
Source: modal.dart
Classes
ModalChoice
A choice in a confirmation modal.
Constructor
dart
const ModalChoice(this.label, this.hotkey)Properties
| Property | Type | Description |
|---|---|---|
label | String | |
hotkey | String |
ConfirmModal
An inline confirmation prompt rendered in the content flow.
Displays a highlighted title bar with context, followed by selectable choices. Navigate with ←/→ or press hotkeys directly.
Constructor
dart
ConfirmModal({
required this.title,
required this.bodyLines,
required this.choices,
})Properties
| Property | Type | Description |
|---|---|---|
title | String | |
bodyLines | List<String> | |
choices | List<ModalChoice> | |
result | Future<int> get | The future that resolves with the index of the chosen option. |
isComplete | bool get | Whether the modal has been resolved. |
selected | int get | The currently selected choice index. |
result | Future<int> get | The future that resolves with the index of the chosen option. |
isComplete | bool get | Whether the modal has been resolved. |
selected | int get | The currently selected choice index. |
Methods
bool handleEvent(TerminalEvent event)
Handle a terminal event. Returns true if consumed.
void cancel()
Cancel the modal by completing with the "No"/deny choice.
List<String> render(int terminalWidth)
Render the modal as lines to be appended to the output.