Cursor class

Document cursor.

DATA MODEL: the cursor directly stores (fragmentId, localOffset), where fragmentId is the id of a leaf Fragment and localOffset is the offset within the text of that fragment.

preferredX replaces the old preferredColumn (integer index): it is the x coordinate in pixels of the caret at the start of a vertical sequence. It is preserved during consecutive Up/Down and reset to -1.0 by Left/Right and click.

Inheritance

Constructors

Cursor({String? anchorId, int? anchorOffset, String? focusId, int? focusOffset})

Properties

anchorId String
getter/setter pair
anchorOffset int
getter/setter pair
document FluentDocument
getter/setter pair
focusId String
getter/setter pair
focusOffset int
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
imeComposing bool
True when an IME composition is active. During composition the cursor is visually locked at imeComposingStart so the user sees a stable insertion point while the preedit text changes.
getter/setter pair
imeComposingStart int
The local offset where the active IME composition started. The cursor caret is painted at this position during composition.
getter/setter pair
isCollapsed bool
no setter
preferredX double
Preferred x coordinate for vertical navigation (Up/Down). -1.0 = to recalculate (reset after Left/Right/click).
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
batchUpdate(void fn()) → void
Executes fn with notifications suppressed, then notifies once.
dispose() → void
Discards any resources used by the object.
inherited
focusTo(String fragmentId, int localOffset, {bool forward = true}) → void
Updates only the focus (to extend selection, e.g.: shift+arrow, drag).
forward() → void
moveTo(String fragmentId, int localOffset, {bool forward = true}) → void
Moves the cursor (collapsed) to (fragmentId, localOffset). Resets preferredX: a click or horizontal movement cancels the column.
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
toString() String
A string representation of this object.
override

Operators

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