muse library
Muse — high-level widget and application API.
This barrel exposes the public surface needed to build TUI apps with the
Flutter-like widget framework. For renderer/buffer primitives, render-tree
internals, or framework plumbing (Element, RenderObject, BuildOwner), see
package:muse/muse_low_level.dart.
For raw FFI (ABI-unstable), see package:muse/muse_ffi.dart.
import 'package:muse/muse.dart';
Classes
-
Action<
T extends Intent> - Handles semantic intents.
- Actions
- Inherited map from intent type to Action.
- ActivateIntent
- Activates the currently focused control.
- Align
- A widget that aligns its child within itself.
- Alignment
-
An alignment within a rectangle, expressed as fractional coordinates in
[-1, 1]on each axis.(-1, -1)is the top-left corner,(0, 0)is the center,(1, 1)is the bottom-right corner. -
Animation<
T> - Animation type.
- AnimationController
- AnimationController type.
- Border
- A border drawn around a rectangular region of a terminal.
- BoxBorder
- Base class for box borders (like Border).
- BoxConstraints
- Box-shaped layout constraints with independent min/max on each axis.
- BoxDecoration
- An immutable description of how to paint a box.
- BuildContext
- BuildContext type.
-
CallbackAction<
T extends Intent> - Action backed by a Dart callback.
- ChangeNotifier
- Default Listenable implementation backed by a listener list.
- CharacterActivator
- Matches a printable character plus optional exact modifiers.
- Color
- Immutable RGBA color stored as normalized (0–1) channel values.
- Column
- A widget that displays its children in a vertical array.
- ConstrainedBox
- A widget that imposes additional constraints on its child.
- Constraints
- Layout constraints handed down from a parent to a child during the constraint-down / size-up layout pass.
- Container
- A convenience widget that combines common painting, positioning, and sizing widgets.
- DecoratedBox
- A widget that paints a Decoration either before or after its child paints.
- Decoration
- A description of a box decoration (a decoration applied to a Rect).
- DeleteBackwardIntent
- Deletes the character before the cursor.
- DeleteForwardIntent
- Deletes the character after the cursor.
- DismissIntent
- Dismisses the current interaction.
- Disposable
- Interface for objects that release resources explicitly.
- EdgeInsets
- Insets from each edge of a rectangle, in terminal character cells.
- Expanded
- A Flexible that forces its child to fill the available main-axis space.
- Flex
- Base class for widgets that arrange children in a one-dimensional array.
- Flexible
- A widget that gives its child a share of the main-axis space in a Flex.
- Focus
- Focus type.
- FocusNode
- FocusNode type.
- FocusScope
- FocusScope type.
- FocusScopeNode
- FocusScopeNode type.
- FocusTraversalPolicy
- Determines how focus moves through a FocusScopeNode.
-
GlobalKey<
T extends State< StatefulWidget> > - GlobalKey type.
- InheritedWidget
- Base class for widgets that efficiently propagate information down the tree.
- InlineSpan
- Base class for inline text content.
- InputManager
- Input manager for handling terminal input events.
- InputPriority
- Standard priority constants used by InputManager.
- InputSubscription
- Handle returned from InputManager.onKey, InputManager.onMouse, and InputManager.onPaste. Call cancel to remove the underlying subscription; safe to call multiple times.
- InsertTabIntent
- Inserts a tab/indentation into an editable control.
- InsertTextIntent
- Inserts text into an editable control.
- Intent
- Base class for semantic input commands.
- Key
- Key type.
- KeyEvent
- Keyboard input event delivered to registered KeyEventHandler listeners.
- KeyModifiers
- Keyboard modifier bitmask constants for use with KeyEvent.modifiers.
- KittyFlags
- Kitty keyboard protocol enhancement flags for use with KeyboardSupport.enableKittyKeyboard.
- Listenable
- Object that can notify listeners when its observable state changes.
- LocalKey
- LocalKey type.
- LogicalKeyboardKey
- Logical keyboard key identity independent of the raw terminal sequence.
- MouseEvent
- Mouse input event delivered to registered MouseEventHandler listeners.
- MoveCaretDocumentEndIntent
- Moves the caret to the document end.
- MoveCaretDocumentStartIntent
- Moves the caret to the document start.
- MoveCaretDownIntent
- Moves the caret down.
- MoveCaretLeftIntent
- Moves the caret left.
- MoveCaretLineEndIntent
- Moves the caret to the current line end.
- MoveCaretLineStartIntent
- Moves the caret to the current line start.
- MoveCaretRightIntent
- Moves the caret right.
- MoveCaretUpIntent
- Moves the caret up.
- MoveSelectionDownIntent
- Moves a selection one item down.
- MoveSelectionFirstIntent
- Moves a selection to the first item.
- MoveSelectionLastIntent
- Moves a selection to the last item.
- MoveSelectionPageDownIntent
- Moves a selection by one page down.
- MoveSelectionPageUpIntent
- Moves a selection by one page up.
- MoveSelectionUpIntent
- Moves a selection one item up.
- NextFocusIntent
- Moves focus to the next focusable node.
-
ObjectKey<
T> - ObjectKey type.
- Offset
- A 2D offset in terminal character cells (integer-positioned).
- Padding
- A widget that insets its child by the given padding.
- PasteEvent
- A bracketed-paste block delivered as a single event instead of one synthetic key event per character. Subscribe via InputManager.onPaste.
- PersistentUtf8Text
- Reusable native UTF-8 storage for passing stable, nul-terminated text bytes to OpenTUI across frames.
- PointerListener
- PointerListener type.
- PreviousFocusIntent
- Moves focus to the previous focusable node.
- ProxyWidget
- A widget that proxies its configuration to a single child.
- Rect
- An axis-aligned rectangle in terminal character cells (integer positioned).
- RichText
- Displays an InlineSpan tree.
- Row
- A widget that displays its children in a horizontal array.
- ScrollBox
-
A scrollable container, parity with OpenTUI-React
<scrollbox>. - ScrollController
- Observable scroll state shared between ScrollBox and its consumers.
- ScrollDownIntent
- Scrolls down.
- ScrollLeftIntent
- Scrolls left.
- ScrollPageDownIntent
- Scrolls one page down.
- ScrollPageUpIntent
- Scrolls one page up.
- ScrollRightIntent
- Scrolls right.
- ScrollToEndIntent
- Scrolls to the end.
- ScrollToStartIntent
- Scrolls to the beginning.
- ScrollUpIntent
- Scrolls up.
-
Select<
T> -
A scrollable list-of-options selector, parity with OpenTUI-React
<select>. -
SelectOption<
T> - A single option in a Select list.
- ShortcutActivator
- Matches a KeyEvent and chooses a semantic Intent.
- Shortcuts
- Inherited map from keyboard activators to semantic intents.
- SingleActivator
- Matches a logical key plus optional exact modifiers.
- Size
- A 2D size in terminal character cells.
- SizedBox
- A box with a fixed width and/or height that constrains its child.
-
State<
T extends StatefulWidget> - Mutable state for a StatefulWidget.
- StatefulWidget
- A widget that has mutable state managed by a State object.
- StatelessWidget
- A widget that describes its UI by building other widgets.
- SubmitTextIntent
- Submits an editable control.
- TerminalCapabilities
- Terminal feature capabilities detected at runtime.
- TerminalSize
- Terminal dimensions in columns and rows.
- Text
- A run of text with a single style optimized for terminal rendering.
- TextArea
-
Multi-line text input, parity with OpenTUI-React
<textarea>. - TextEditingController
- Controls editable text through an immutable TextEditingValue.
- TextEditingValue
- Immutable text editing state: text, selection, and composing range.
- TextHighlight
- Configuration for highlighting a range of text within a RenderParagraph.
- TextIndexMap
- Maps between UTF-16 offsets, grapheme indices, terminal cells, and UTF-8 byte offsets for a single immutable text snapshot.
- TextInput
- A text input widget with cursor support.
- TextInputConnection
- Applies text-editing shortcuts and intents to a TextEditingController.
- TextLayout
- A laid-out text snapshot.
- TextLayoutEngine
- Lays out inline spans against terminal box constraints.
- TextLayoutLine
- One laid-out terminal text line.
- TextLayoutRun
- One styled run within a laid-out text line.
- TextRange
- A range of text represented with UTF-16 offsets.
- TextSelection
- A text selection represented with base and extent UTF-16 offsets.
- TextSpan
- A text span with optional children.
- TextStyle
- An immutable style describing how to format and paint text.
- TextStyles
- Pre-defined text styles for common use cases
- Ticker
- Ticker type.
- TickerProvider
- TickerProvider type.
- TickerScheduler
- TickerScheduler type.
- TuiApp
- Simple owning convenience session for a mounted TUI app.
- TuiBinding
- Owns the app lifecycle graph for an OpenTUI widget tree.
- UniqueKey
- UniqueKey type.
-
ValueKey<
T> - ValueKey type.
-
ValueListenable<
T> - A Listenable that exposes a current value.
-
ValueNotifier<
T> - A ChangeNotifier that publishes one value.
- ViewportController
-
Shared viewport math used by
Select,ScrollBox, and any future scrollable widget. Keeps a single source of truth for offset clamping, paging, and ensure-visible logic so subtle off-by-ones don't drift between widgets. - Widget
- Immutable description of part of the user interface.
Enums
- AnimationStatus
- Values for AnimationStatus.
- BorderStyle
- The style of line to draw for a Border.
- BoxShape
- The shape used when rendering a BoxDecoration.
- ColorSupport
- Terminal color support levels, from no color to 24-bit true color.
- CrossAxisAlignment
- How the children should be placed along the cross axis in a flex layout.
- CursorStyle
- Cursor styles supported by terminals
- DecorationPosition
- Where to paint a box decoration.
- FlexFit
- How a flexible child is allowed to size itself along the main axis.
- FontStyle
- Whether to slant the glyphs in the font.
- FontWeight
- The thickness of the glyphs used to draw text.
- KeyEventResult
- Result returned by key-event handlers in the focus/shortcut pipeline.
- MainAxisAlignment
- How the children should be placed along the main axis in a flex layout.
- MainAxisSize
- How much space should be occupied in the main axis.
- MouseButton
- Mouse buttons distinguished by the terminal.
- MouseEventType
- Kinds of mouse interaction reported by the terminal.
- TextAffinity
- Directional preference for a collapsed text selection at a line break.
- TextAlign
- How text should be aligned horizontally.
- TextDecoration
- A linear decoration to draw near the text.
- TextEffect
- Terminal-specific text effects not available in Flutter.
- TextOverflow
- Overflow behaviour for terminal text rendering.
- WidthMethod
- Width calculation methods for text
Mixins
-
SingleTickerProviderStateMixin<
T extends StatefulWidget> - SingleTickerProviderStateMixin mixin.
-
TickerProviderStateMixin<
T extends StatefulWidget> - TickerProviderStateMixin mixin.
Extensions
- CapabilitiesDetection on Renderer
- Capability-detection methods added to Renderer.
Functions
-
cellToGraphemeIndex(
String text, int cell) → int - Inverse of graphemeIndexToCell: given a column offset in cells, return the grapheme index that starts at or just before that column. Used by click-to-cursor mapping.
-
graphemeIndexToCell(
String text, int index) → int -
Cell-column position of grapheme
indexwithintext(assumingtextis laid out left-to-right with each cluster taking terminalCellWidth cells). Equivalent toterminalStringWidth(text up to grapheme #index). -
runTuiApp(
Widget app, {int width = 80, int height = 24, bool headless = false, InputManager? inputManager, Renderer? renderer}) → TuiBinding -
Runs
appthrough a TuiBinding and returns the lifecycle handle. -
sliceByCells(
String text, int maxCells) → String -
Slice
textto fit withinmaxCellsterminal cells starting from the beginning, respecting grapheme cluster boundaries. A wide cluster that would push the result pastmaxCellsis dropped entirely (we never paint a "half" wide cluster). -
terminalCellWidth(
String cluster) → int - Returns the terminal cell width of a single grapheme cluster.
-
terminalStringWidth(
String text) → int -
Returns the terminal cell width of
textby summing the width of each grapheme cluster.
Typedefs
- AnimationStatusListener = void Function(AnimationStatus status)
- AnimationStatusListener callback type.
- FocusOnKeyEvent = KeyEventResult Function(FocusNode node, KeyEvent event)
- FocusOnKeyEvent callback type.
- KeyEventHandler = void Function(KeyEvent event)
- Callback signature for key event listeners registered with InputManager.onKey.
- MouseEventHandler = void Function(MouseEvent event)
- Callback signature for mouse event listeners registered with InputManager.onMouse.
- PasteEventHandler = void Function(PasteEvent event)
- Callback signature for paste event listeners registered with InputManager.onPaste.
-
SelectChanged<
T> = void Function(int index, SelectOption< T> option) - Signature for callbacks invoked when the highlighted option changes.
-
SelectConfirmed<
T> = void Function(int index, SelectOption< T> option) - Signature for callbacks invoked when the user confirms a selection.
- TickerCallback = void Function(Duration elapsed)
- TickerCallback callback type.
-
ValueChanged<
T> = void Function(T value) -
Signature for callbacks that receive a changed value of type
T. - VoidCallback = void Function()
- Callback with no arguments and no return value.