SelectableController class

Provides a way to be notified of selection changes and a way to select and deselect text.

Inheritance

Constructors

SelectableController()

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isTextSelected bool
Returns true if text is selected in any selections.
no setter
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
deselect({int? key}) bool
If text is selected, deselects it. Returns true if the selection was updated to be deselected.
deselectAll() bool
If text is selected, deselects it. Returns true if any selections were updated to be deselected.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
getContainedText() String
Returns a String containing the combined text of all render paragraphs contained in the Selectable. This can be used with selectWordAtIndex and selectWordsBetweenIndexes to select a word or words.
getCustomPainter({int? key}) SelectionPainter?
Returns the selection painter, or null if none.
getCustomRectifier({int? key}) → (List<Rect> Function(List<Rect>)?)
Returns the custom rectifier, or null if none.
getSelection({int? key}) Selection?
Returns the selection, or null if a selection with the provided key does not exist. Note, if key is not provided, it returns the main selection (with key 0), which is guaranteed to be non-null.
hide({Duration? duration, int? key}) bool
Hides the selection, if it is not already hidden. Returns true if the selection was updated to be hidden.
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
selectAll({int? key}) bool
Attempts to select all the words in the text, if any. Returns true if successful.
selectWordAtIndex(int index, {int? key}) bool
Attempts to select the word at index, returning true if successful.
selectWordAtPoint(Offset point, {int? key}) bool
Attempts to select the word under point, returning true if successful.
selectWordsBetweenAnchors(SelectionAnchor start, SelectionAnchor end, {int? key}) bool
Attempts to select the words between start and end selection anchors, returning true if successful.
selectWordsBetweenIndexes(int start, int? end, {int? key}) bool
Attempts to select the words between start and end indexes, returning true if successful.
selectWordsBetweenPoints(Offset startPt, Offset endPt, {int? key}) bool
Attempts to select the words between startPt and endPt, returning true if successful.
setCustomPainter(SelectionPainter? painter, {int? key}) → void
Sets the custom selection painter to be used to paint selections.
setCustomRectifier(List<Rect> rectifier(List<Rect>)?, {int? key}) → void
Sets the custom rectifier, which is used to convert the raw rectangles of selected text into the displayed selection rects.
toString() String
A string representation of this object.
inherited
unhide({Duration? duration, int? key}) bool
Unhides the selection, if it isn't already unhidden. Returns true if the selection was updated to be unhidden.
visitContainedSpans(bool visitor(SelectionParagraph paragraph, InlineSpan span, int index)) bool
Walks the tree of render objects contained in the Selectable, and the sub-tree of each render paragraph's InlineSpan children in pre-order, calling visitor for each span that has content. A span has content if it is a TextSpan whose text property is not null, or it is a WidgetSpan.

Operators

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