TextAreaController class
Controls the state of a TextArea.
- Inheritance
-
- Object
- ChangeNotifier
- TextAreaController
- Implemented types
Constructors
- TextAreaController({String? text, TextAreaModel? model})
Properties
- activeDiagnostic → TextDiagnosticRange?
-
no setter
- canRedo → bool
-
Whether there is an undone edit available to redo.
no setter
- canUndo → bool
-
Whether there is an edit available to undo.
no setter
- column → int
-
Current cursor column.
no setter
-
decorations
→ List<
TextDecorationRange> -
no setter
-
diagnostics
→ List<
TextDiagnosticRange> -
no setter
- document → TextDocument
-
Current non-selection decoration ranges in flat document offsets.
no setter
- focused → bool
-
Whether the textarea is focused.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hasSelection → bool
-
Whether there is a non-collapsed selection.
no setter
- line → int
-
Current cursor line.
no setter
-
lineDecorations
→ List<
TextLineDecoration> -
no setter
- model ↔ TextAreaModel
-
The underlying textarea model.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedText → String
-
Current selected text, if any.
no setter
- 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
- text ↔ String
-
Current plain-text value.
getter/setter pair
- value → String
-
Current plain-text value.
no setteroverride
Methods
-
addListener(
void listener()) → void -
Register
listenerto be called when the object notifies.inherited -
applyTextCommandResult(
TextCommandResult result, {bool pushHistoryBoundary = true}) → void - Applies an offset-based editor-core command result.
-
applyTextCursorCommandResult(
TextCursorCommandResult result, {bool pushHistoryBoundary = true}) → void - Applies an offset-cursor editor-core command result.
-
applyTextLineCommandResult(
TextLineCommandResult result, {bool pushHistoryBoundary = true}) → void - Applies a line-based editor-core command result.
-
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.
-
clear(
) → void - Replaces the text content and resets the cursor to the end.
-
clearDecorationLayer(
String layerKey) → void - Clears one named decoration layer.
-
clearDecorations(
) → void - Clears non-selection decoration ranges.
-
clearDiagnostics(
) → void - Clears typed diagnostic overlays.
-
clearHistory(
) → void - Clears all undo and redo history.
-
clearLineDecorationLayer(
String layerKey) → void - Clears one named whole-line decoration layer.
-
clearLineDecorations(
) → void - Clears whole-line decorations across all layers.
-
clearSelection(
) → void - Clears the current selection.
-
consumeLastDocumentChange(
) → TextDocumentChange? - Returns and clears the most recent document-aware text change, if any.
-
decorationsForLayer(
String layerKey) → List< TextDecorationRange> -
deleteLines(
) → bool - Deletes the selected lines, or the current line if there is no selection.
-
dispose(
) → void -
Releases all listeners. After this call the notifier should not be used.
inherited
-
duplicateLinesAbove(
) → bool - Duplicates the selected lines, or the current line, above the current block.
-
duplicateLinesBelow(
) → bool - Duplicates the selected lines, or the current line, below the current block.
-
focus(
) → Cmd? - Focuses the textarea.
-
indentLines(
{int width = 2}) → bool - Indents the selected lines, or the current line if there is no selection.
-
insertText(
String text) → void - Inserts text at the current cursor location.
-
joinLines(
) → bool - Joins the current line with the next line, or joins the selected block into a single line.
-
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
-
notifyListeners(
) → void -
Notify all registered listeners.
inherited
-
outdentLines(
{int width = 2}) → bool - Outdents the selected lines, or the current line if there is no selection.
-
pushHistoryBoundary(
) → void - Starts a fresh undo step for the next edit.
-
redo(
) → bool - Reapplies the most recently undone edit state.
-
removeListener(
void listener()) → void -
Remove a previously registered
listener.inherited -
renumberNumberedList(
{int startAt = 1}) → bool - Renumbers existing numbered list items in the current line or selected block.
-
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 -
Selects the diagnostic that covers
lineIndex, if any. -
selectNextDiagnostic(
{bool wrap = true}) → bool - Selects the next diagnostic range.
-
selectPreviousDiagnostic(
{bool wrap = true}) → bool - Selects the previous diagnostic range.
-
setCursor(
int row, int col) → void - Sets the cursor location.
-
setDecorationLayer(
String layerKey, Iterable< TextDecorationRange> decorations, {int priority = textDefaultDecorationLayerPriority}) → void - Applies decoration ranges to a named layer.
-
setDecorations(
Iterable< TextDecorationRange> decorations) → void - Applies document decoration ranges used for search or other overlays.
-
setDiagnostics(
Iterable< TextDiagnosticRange> diagnostics) → void - Applies typed diagnostic range and line overlays.
-
setDiagnosticsFromPositions(
Iterable< TextPositionDiagnosticRange> diagnostics) → void - Applies typed diagnostic overlays from line/column positions.
-
setLineDecorationLayer(
String layerKey, Iterable< TextLineDecoration> decorations, {int priority = textDefaultLineDecorationLayerPriority}) → void - Applies whole-line decorations to a named layer.
-
setLineDecorations(
Iterable< TextLineDecoration> decorations) → void - Applies whole-line decorations to the default line layer.
-
setSelection(
{required int baseLine, required int baseColumn, required int extentLine, required int extentColumn}) → void - Sets a multi-line selection and places the cursor at the extent.
-
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 current selection with a newline.
-
throwIfDisposed(
) → void -
Throws StateError if this notifier has already been disposed.
inherited
-
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
prefixon 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 previous edit state.
-
unwrapSelection(
) → bool - Removes a matching surrounding delimiter pair around the current selection.
-
update(
Msg msg) → Cmd? - Forwards a message to the textarea model.
-
uppercaseSelectionOrLine(
) → bool - Uppercases the selected range, or the current line when there is no selection.
-
wrapSelection(
String before, {String? after}) → bool -
Wraps the current selection with
beforeandafter.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited