Help class
A widget that formats and displays keybindings, auto-wrapping them to fit.
It aligns a dictionary of key-to-description bindings horizontally. If the bindings exceed the available width, it wraps them down to subsequent lines within the layout's constraints.
Example Usage
Help(
bindings: const {
'Ctrl+Q': 'Quit',
'Tab': 'Next Field',
'Enter': 'Submit',
},
separator: ' | ',
);
Properties and Settings
| Property | Type | Description |
|---|---|---|
bindings |
Map<String, String> | Key-value pairs of keybind names and description. |
keyStyle |
Style | Style applied to key labels (defaults to bold). |
descStyle |
Style | Style applied to description labels (defaults to dim). |
separatorStyle |
Style | Style applied to the separator between bindings. |
separator |
String | Separator character or string. Defaults to •. |
Constructors
-
Help({required Map<
String, String> bindings, Style keyStyle = const Style(modifiers: Modifier.bold), Style descStyle = const Style(modifiers: Modifier.dim), Style separatorStyle = const Style(modifiers: Modifier.dim), String separator = ' • '}) -
Creates a Help widget to display a horizontal list of key bindings.
const
Properties
-
bindings
→ Map<
String, String> -
A dictionary mapping key bindings to their descriptions.
final
- descStyle → Style
-
The style applied to the descriptions text.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
The optional key for this widget.
finalinherited
- keyStyle → Style
-
The style applied to the key bindings text.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- separator → String
-
The string used to separate key bindings.
final
- separatorStyle → Style
-
The style applied to the separator text.
final
Methods
-
createElement(
) → Element -
Creates an Element to manage this widget's location in the tree.
inherited
-
getIntrinsicHeight(
int width) → int -
Computes the intrinsic height of this widget under the given
widthconstraint.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
render(
Buffer buffer, Rect area) → void -
Renders the widget onto the provided
bufferwithin the specifiedarea.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited