TextInputModel class

Text input model for single-line text entry.

Features:

  • Character and word navigation
  • Delete operations (character, word, line)
  • Echo modes (normal, password, none)
  • Suggestions/autocomplete
  • Horizontal scrolling for long text
  • Validation

Example:

final input = TextInputModel(
  prompt: 'Name: ',
  placeholder: 'Enter your name',
);
Inheritance

Constructors

TextInputModel({String prompt = '> ', String placeholder = '', EchoMode echoMode = EchoMode.normal, String echoCharacter = '*', int charLimit = 0, int width = 0, bool showSuggestions = false, bool useVirtualCursor = true, TextInputKeyMap? keyMap, CursorModel? cursor, ValidateFunc? validate, TextInputStyles? styles})
Creates a new text input model.

Properties

availableSuggestions List<String>
Gets available suggestions.
no setter
charLimit int
Maximum characters allowed (0 = unlimited).
getter/setter pair
currentSuggestion String
Gets current suggestion.
no setter
currentSuggestionIndex int
Gets current suggestion index.
no setter
cursor CursorModel
Cursor model.
getter/setter pair
echoCharacter String
Character to show in password mode.
getter/setter pair
echoMode EchoMode
Echo mode for displaying text.
getter/setter pair
error String?
Current validation error.
getter/setter pair
focused bool
Whether the input is focused.
no setter
hashCode int
The hash code for this object.
no setterinherited
keyMap TextInputKeyMap
Key bindings.
getter/setter pair
matchedSuggestions List<String>
Gets matched suggestions.
no setter
placeholder String
Placeholder text when empty.
getter/setter pair
position int
Gets the cursor position.
getter/setter pair
prompt String
Prompt displayed before input.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showSuggestions bool
Whether to show suggestions.
getter/setter pair
styles TextInputStyles
Styles for the text input.
getter/setter pair
suggestions List<String>
Sets available suggestions for autocomplete.
no getter
terminalCursor → Cursor?
Returns a Cursor for rendering a real cursor in a TUI program. This requires that useVirtualCursor is set to false.
no setter
useVirtualCursor bool
Whether to use a virtual cursor. If false, use terminalCursor to return a real cursor for rendering.
getter/setter pair
validate ValidateFunc?
Validation function.
getter/setter pair
value String
Gets the current value as a string.
getter/setter pair
width int
Display width for horizontal scrolling (0 = unlimited).
getter/setter pair

Methods

activeStyle() TextInputStyleState
Returns the appropriate style state based on focus.
blur() → void
Blur (unfocus) the input.
cursorEnd() → void
Move cursor to end.
cursorStart() → void
Move cursor to start.
focus() Cmd?
Focus the input.
getSelectedText() String
Returns the currently selected text.
init() Cmd?
Returns an optional command to execute on program startup.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Reset the input to empty.
setValue(String s) → void
Sets the value of the text input (parity with bubbles).
toString() String
A string representation of this object.
inherited
update(Msg msg) → (TextInputModel, Cmd?)
Updates the component state in response to a message.
override
view() Object
Renders the current model state for display.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited