TerminalView class
Pure render + input view over a TerminalEngine.
Owns render state (font, metrics, glyph cache, bell controller, blink
timer), IME session, and pointer/selection state. Hotkeys are dispatched
through Flutter's Shortcuts + Actions framework rather than an
inline switch — see shortcuts and actions. Does NOT own the engine,
the PTY, the search bar widget, drop handling, the right-click context
menu, or URL launching — those stay on the host (the reference example
is ExampleTerminalApp) and are wired in via the callback hooks below.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- TerminalView
Constructors
-
TerminalView(TerminalEngine engine, {Key? key, TerminalController? controller, TerminalTheme theme = TerminalTheme.defaults, TerminalStyle? textStyle, EdgeInsets? padding, double backgroundOpacity = 1.0, FocusNode? focusNode, bool autofocus = true, MouseCursor mouseCursor = SystemMouseCursors.text, bool readOnly = false, Duration cursorBlinkInterval = const Duration(milliseconds: 530), Duration cursorBlinkTimeout = const Duration(seconds: 5), Duration bellDuration = Duration.zero, Duration doubleClickThreshold = const Duration(milliseconds: 300), int scrollMultiplier = 3, int preeditBg = 0x282828, int preeditFg = 0xD8D8D8, bool preeditUnderline = true, Map<
ShortcutActivator, Intent> ? shortcuts, Map<Type, Action< ? actions, void onTapDown(TapDownDetails, CellOffset)?, void onTapUp(TapUpDetails, CellOffset)?, void onSecondaryTapDown(TapDownDetails, CellOffset)?, void onSecondaryTapUp(TapUpDetails, CellOffset)?, void onLinkActivate(String uri)?, bool primaryTapActivatesLink = false, void onBell()?, void onPtyResize(int columns, int rows)?, List<Intent> >TerminalLinkProvider> ? linkProviders})
Properties
-
actions
→ Map<
Type, Action< ?Intent> > -
Action handlers for the intents dispatched by shortcuts.
nullmeans the view builds defaultTerminalActions internally (with a no-op paste/search/zoom and a self-contained copy that writes the engine selection to the system clipboard). Hosts typically supply their own actions to wire host-side semantics (search-bar visibility, custom paste filtering, etc.).final - autofocus → bool
-
final
- backgroundOpacity → double
-
final
- bellDuration → Duration
-
Bell flash duration (zero disables the visual bell).
final
- controller → TerminalController?
-
final
- cursorBlinkInterval → Duration
-
Cursor blink half-period.
final
- cursorBlinkTimeout → Duration
-
Stop blinking after this much inactivity (no terminal input); the cursor
then stays solid until the next input.
Duration.zero= never stop. Mirrors alacritty'scursor.blink_timeout.final - doubleClickThreshold → Duration
-
Double/triple-click window for word/line selection.
final
- engine → TerminalEngine
-
final
- focusNode → FocusNode?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
linkProviders
→ List<
TerminalLinkProvider> -
Host-injectable link sources. Defaults to
const [](no per-line regex scan on PTY output); pass e.g.[UrlLinkProvider()]to enable URL detection. OSC 8 hyperlinks from the engine work without any provider.final - mouseCursor → MouseCursor
-
final
- onBell → void Function()?
-
Bell event hook (fires in addition to the visual flash). If null, the
view plays a system alert sound (current behavior).
final
- onLinkActivate → void Function(String uri)?
-
final
- onPtyResize → void Function(int columns, int rows)?
-
Fired after the engine and mirror grid adopt
(columns, rows). Wire toPtyBackend.resize(rows, columns). The engine resizes before this fires.final - onSecondaryTapDown → void Function(TapDownDetails, CellOffset)?
-
final
- onSecondaryTapUp → void Function(TapUpDetails, CellOffset)?
-
final
- onTapDown → void Function(TapDownDetails, CellOffset)?
-
final
- onTapUp → void Function(TapUpDetails, CellOffset)?
-
final
- padding → EdgeInsets?
-
final
- preeditBg → int
-
Preedit overlay colors / underline (packed RGB, alpha forced full).
final
- preeditFg → int
-
final
- preeditUnderline → bool
-
final
- primaryTapActivatesLink → bool
-
When true, a plain (unmodified) left-click on a hyperlink or detected-link
cell fires onLinkActivate instead of forwarding the click to the program
(or starting a selection). Ctrl/Cmd-click always activates links
regardless. Non-link cells are unaffected — they still select / report to
the program as usual. Defaults to
falseto preserve standard terminal mouse semantics; hosts that prefer click-to-open opt in.final - readOnly → bool
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollMultiplier → int
-
Approximate lines scrolled per wheel notch (alacritty's
scrolling.multiplier; default 3). History wheel uses discretescrollLines; touch pan/fling use sub-cellscrollPixels. The multiplier is applied to the platform pixel delta asscrollMultiplier / 3— a raw wheel notch is ~3 lines of pixels, so the default reproduces alacritty's 3-lines/notch and e.g.1≈ one line/notch.final -
shortcuts
→ Map<
ShortcutActivator, Intent> ? -
Hotkey bindings.
nullmeans use defaultTerminalShortcuts; pass an empty map (const {}) to disable every default; pass any other map to override individual entries (the view does NOT merge with defaults — the supplied map is the complete shortcut set).final - textStyle → TerminalStyle
-
final
- theme → TerminalTheme
-
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< TerminalView> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited