TextAreaModel class

Inheritance

Constructors

TextAreaModel({String prompt = '│ ', String placeholder = '', bool showLineNumbers = true, int charLimit = 0, bool softWrap = true, int width = 0, int height = 6, bool useVirtualCursor = true, TextAreaKeyMap? keyMap, CursorModel? cursor, TextAreaStyles? styles})

Properties

activeDiagnostic TextDiagnosticRange?
no setter
canRedo bool
no setter
canUndo bool
no setter
charLimit int
getter/setter pair
column int
no setter
cursor CursorModel
Cursor model.
getter/setter pair
decorations List<TextDecorationRange>
no setter
diagnostics List<TextDiagnosticRange>
no setter
document TextDocument
no setter
editorState EditorState
no setter
focused bool
no setter
hashCode int
The hash code for this object.
no setterinherited
hasSelection bool
no setter
height int
no setter
keyMap TextAreaKeyMap
getter/setter pair
length int
no setter
line int
no setter
lineCount int
no setter
lineDecorations List<TextLineDecoration>
no setter
placeholder String
getter/setter pair
prompt String
getter/setter pair
promptFunc PromptFunc?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionBase → ({int column, int line})?
Anchor position of the current selection, if any.
no setter
selectionExtent → ({int column, int line})?
Active extent position of the current selection, if any.
no setter
showLineNumbers bool
getter/setter pair
softWrap bool
getter/setter pair
styles TextAreaStyles
Styles for the textarea.
getter/setter pair
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
value String
Returns the current value of the textarea.
getter/setter pair
width int
no setter

Methods

activeStyle() TextAreaStyleState
Returns the appropriate style state based on focus.
applyTextCommandResult(TextCommandResult result, {bool pushHistoryBoundary = false}) → void
Applies an offset-based command result to the live document state.
applyTextCursorCommandResult(TextCursorCommandResult result, {bool pushHistoryBoundary = false}) → void
Applies an offset cursor command result to the live document state.
applyTextLineCommandResult(TextLineCommandResult result, {bool pushHistoryBoundary = false}) → void
Applies a line-based command result to the live document state.
blur() → void
Blurs the textarea.
capitalizeSelectionOrLine() bool
Capitalizes words in the selected range, or the current line when there is no selection.
cleanupWhitespace({bool trimTrailingBlankLines = true}) bool
Cleans up trailing horizontal whitespace in the selected block, or the entire buffer when there is no selection.
clearDecorationLayer(String layerKey) bool
clearDecorations() bool
clearDiagnostics() bool
clearHighlights() bool
clearHistory() → void
Clears all undo and redo history.
clearLineDecorationLayer(String layerKey) bool
clearLineDecorations() bool
clearSelection() → void
Clears the current selection.
consumeLastDocumentChange() TextDocumentChange?
cursorColumn() int
Returns the current cursor column (0-indexed).
cursorEnd() → void
cursorLine() int
Returns the current cursor line (0-indexed).
cursorStart() → void
decorationsForLayer(String layerKey) List<TextDecorationRange>
deleteLines() bool
Deletes the selected lines, or the current line if there is no selection.
duplicateLinesAbove() bool
Duplicates the selected lines, or the current line, above the current block and moves the selection/cursor to the duplicate.
duplicateLinesBelow() bool
Duplicates the selected lines, or the current line, below the current block and moves the selection/cursor to the duplicate.
focus() Cmd?
Focuses the textarea.
getSelectedText() String
Returns the currently selected text.
indentLines({int width = 2}) bool
Indents the selected lines, or the current line if there is no selection.
init() Cmd?
Returns an optional command to execute on program startup.
override
insertString(String s) → void
isFocused() bool
Returns whether the textarea is focused.
joinLines() bool
Joins the current line with the next line, or joins the selected block into a single line.
lineAt(int i) String
Returns the text of the line at the given index.
lineDecorationsForLayer(String layerKey) List<TextLineDecoration>
lowercaseSelectionOrLine() bool
Lowercases the selected range, or the current line when there is no selection.
moveLinesDown() bool
Moves the selected lines, or the current line, one row downward.
moveLinesUp() bool
Moves the selected lines, or the current line, one row upward.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
outdentLines({int width = 2}) bool
Outdents the selected lines, or the current line if there is no selection.
pushHistoryBoundary() → void
Breaks the current undo coalescing chain.
redo() bool
Reapplies the most recently undone edit state.
renumberNumberedList({int startAt = 1}) bool
Renumbers existing numbered list items in the current line or selected block.
reset() → void
selectAll() → void
Selects the entire textarea contents.
selectCurrentLine() → void
Selects the current line, or expands the current selection to full lines.
selectDiagnosticAtLine(int lineIndex) bool
selectNextDiagnostic({bool wrap = true}) bool
selectPreviousDiagnostic({bool wrap = true}) bool
setCharLimit(int n) → void
Sets the character limit.
setCursor(int row, int col) → void
Sets the cursor position.
setDecorationLayer(String layerKey, Iterable<TextDecorationRange> decorations, {int priority = textDefaultDecorationLayerPriority}) bool
setDecorations(Iterable<TextDecorationRange> decorations) bool
setDiagnostics(Iterable<TextDiagnosticRange> diagnostics) bool
setDiagnosticsFromPositions(Iterable<TextPositionDiagnosticRange> diagnostics) bool
setHeight(int h) → void
Sets the height of the textarea.
setHighlights(Iterable<TextHighlightRange> highlights, {int activeIndex = -1}) bool
setLineDecorationLayer(String layerKey, Iterable<TextLineDecoration> decorations, {int priority = textDefaultLineDecorationLayerPriority}) bool
setLineDecorations(Iterable<TextLineDecoration> decorations) bool
setPlaceholder(String s) → void
Sets the placeholder text.
setPromptFunc(int promptWidth, PromptFunc fn) → void
Sets the prompt function.
setSelection({required int baseLine, required int baseColumn, required int extentLine, required int extentColumn}) → void
Sets the current selection and places the cursor at the extent.
setText(String v, {bool recordHistory = true}) → void
Replaces the text and collapses the cursor at the end.
setValue(String v) → void
Sets the value of the textarea (method form for API compatibility).
setWidth(int w) → void
Sets the width of the textarea.
sortSelectedLines({bool descending = false, bool caseSensitive = false}) bool
Sorts the selected lines, or the entire buffer when there is no selection.
splitLine() bool
Splits the current line at the cursor, or replaces the selected range with a newline and places the cursor at the start of the new line.
toggleChecklistState({String checkedMarker = 'x'}) bool
Toggles checklist completion state on the current line or selected block.
toggleHeadingPrefix({int level = 1}) bool
Toggles Markdown heading prefixes on the current line or selected block.
toggleLinePrefix(String prefix, {bool addSpaceWhenNonEmpty = true, bool skipBlankLinesWhenChecking = true}) bool
Toggles prefix on the current line or selected block.
toggleNumberedList({int startAt = 1}) bool
Toggles numbered list prefixes on the current line or selected block.
toString() String
A string representation of this object.
inherited
undo() bool
Restores the most recent previous edit state.
unwrapSelection() bool
Removes a matching surrounding delimiter pair around the current selection and preserves the inner selection.
update(Msg msg) → (TextAreaModel, Cmd?)
Updates the component state in response to a message.
override
uppercaseSelectionOrLine() bool
Uppercases the selected range, or the current line when there is no selection.
view() Object
Renders the current model state for display.
override
wrapSelection(String before, {String? after}) bool
Wraps the current selection with before and after.

Operators

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