VirtualKeypadController class

A controller for VirtualKeypadTextField that provides text manipulation methods.

Extends TextEditingController with methods for inserting text, deleting characters, and managing cursor position. Works seamlessly with the virtual keyboard input system.

final controller = VirtualKeypadController();
controller.insertText('Hello');
print(controller.text); // 'Hello'
print(controller.cursorPosition); // 5
Inheritance

Constructors

VirtualKeypadController({String? text})
Creates a controller with optional initial text.

Properties

cursorPosition ↔ int
The current cursor position (caret offset).
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selection ↔ TextSelection
The currently selected range within text.
getter/setter pairinherited
text ↔ String
The current string the user is editing.
getter/setter pairinherited
value ↔ TextEditingValue
The current value stored in this notifier.
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
buildTextSpan({required BuildContext context, TextStyle? style, required bool withComposing}) → TextSpan
Builds TextSpan from current editing value.
inherited
clear() → void
Clears all text and resets the cursor to position 0.
override
clearComposing() → void
Set the composing region to an empty range.
inherited
deleteBackward() → void
Deletes the character before the cursor (backspace).
deleteForward() → void
Deletes the character after the cursor (delete).
deleteRange(int start, int end) → void
Deletes text in the specified range [start, end).
dispose() → void
Discards any resources used by the object.
inherited
insertText(String newText) → void
Inserts text at the current cursor position.
moveCursorLeft() → void
Moves the cursor one position to the left.
moveCursorRight() → void
Moves the cursor one position to the right.
moveCursorToEnd() → void
Moves the cursor to the end of the text.
moveCursorToStart() → void
Moves the cursor to the beginning of the text.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
replaceRange(int start, int end, String replacement) → void
Replaces text in the range [start, end) with replacement.
selectAll() → void
Selects all text in the field.
toString() → String
A string representation of this object.
inherited

Operators

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