StaticSelectionContainerDelegate class
A delegate that manages updating multiple Selectable children where the Selectables do not change or move around frequently.
This delegate keeps track of the Selectables that received start or end SelectionEvents and the global locations of those events to accurately synthesize SelectionEvents for children Selectables when needed.
When a new SelectionEdgeUpdateEvent is dispatched to a Selectable, this delegate checks whether the Selectable has already received a selection update for each edge that currently exists, and synthesizes an event for the edges that have not yet received an update. This synthesized event is dispatched before dispatching the new event.
For example, if we have an existing start edge for this delegate and a Selectable child receives an end SelectionEdgeUpdateEvent and the child hasn't received a start SelectionEdgeUpdateEvent, we synthesize a start SelectionEdgeUpdateEvent for the child Selectable and dispatch it before dispatching the original end SelectionEdgeUpdateEvent.
See also:
- MultiSelectableSelectionContainerDelegate, for the class that provides the main implementation details of this SelectionContainerDelegate.
- Inheritance
-
- Object
- SelectionContainerDelegate
- MultiSelectableSelectionContainerDelegate
- StaticSelectionContainerDelegate
Constructors
Properties
-
compareOrder
→ Comparator<
Selectable> -
The compare function this delegate used for determining the selection
order of the selectables.
no setterinherited
- containerSize → Size
-
Gets the size of the SelectionContainer of this delegate.
no setterinherited
- contentLength → int
-
The total length of the content under this SelectionContainerDelegate.
no setterinherited
- currentSelectionEndIndex ↔ int
-
The current Selectable that contains the selection end edge.
getter/setter pairinherited
- currentSelectionStartIndex ↔ int
-
The current Selectable that contains the selection start edge.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hasSize → bool
-
Whether the SelectionContainer has undergone layout and has a size.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selectables
↔ List<
Selectable> -
Gets the list of Selectables this delegate is managing.
getter/setter pairinherited
- value → SelectionGeometry
-
The current value of the object. When the value changes, the callbacks
registered with addListener will be invoked.
no setterinherited
Methods
-
add(
Selectable selectable) → void -
Adds the
selectable
into the registrar.inherited -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clearInternalSelectionState(
) → void - Clears the internal selection state.
-
clearInternalSelectionStateForSelectable(
Selectable selectable) → void - Clears the internal selection state for a given Selectable.
-
didChangeSelectables(
) → void -
Called when this delegate finishes updating the Selectables.
override
-
didReceiveSelectionBoundaryEvents(
) → void - Updates the internal selection state after a SelectionEvent that selects a boundary such as: SelectWordSelectionEvent, SelectParagraphSelectionEvent, and SelectAllSelectionEvent.
-
didReceiveSelectionEventFor(
{required Selectable selectable, bool? forEnd}) → void - Tracks whether a selection edge update event for a given Selectable was received.
-
dispatchSelectionEvent(
SelectionEvent event) → SelectionResult -
Handles the SelectionEvent sent to this object.
inherited
-
dispatchSelectionEventToChild(
Selectable selectable, SelectionEvent event) → SelectionResult -
Dispatches a selection event to a specific Selectable.
override
-
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).
override
-
ensureChildUpdated(
Selectable selectable) → void -
Ensures the
selectable
child has received the most up to date selection events.override -
getSelectedContent(
) → SelectedContent? -
Copies the selected contents of all Selectables.
inherited
-
getSelection(
) → SelectedContentRange? -
Returns a SelectedContentRange considering the SelectedContentRange
from each Selectable child managed under this delegate.
inherited
-
getSelectionGeometry(
) → SelectionGeometry -
Gets the combined SelectionGeometry for child Selectables.
inherited
-
getTransformFrom(
Selectable child) → Matrix4 -
Gets the paint transform from the Selectable child to
SelectionContainer of this delegate.
inherited
-
getTransformTo(
RenderObject? ancestor) → Matrix4 -
Gets the paint transform from the SelectionContainer of this delegate to
the
ancestor
.inherited -
handleClearSelection(
ClearSelectionEvent event) → SelectionResult -
Removes the selection of all Selectables this delegate manages.
override
-
handleDirectionallyExtendSelection(
DirectionallyExtendSelectionEvent event) → SelectionResult -
Extend current selection in a certain TextGranularity.
inherited
-
handleGranularlyExtendSelection(
GranularlyExtendSelectionEvent event) → SelectionResult -
Extend current selection in a certain TextGranularity.
inherited
-
handleSelectAll(
SelectAllSelectionEvent event) → SelectionResult -
Selects all contents of all Selectables.
override
-
handleSelectionEdgeUpdate(
SelectionEdgeUpdateEvent event) → SelectionResult -
Updates the selection edges.
override
-
handleSelectParagraph(
SelectParagraphSelectionEvent event) → SelectionResult -
Selects a paragraph in a Selectable at the location
SelectParagraphSelectionEvent.globalPosition.
override
-
handleSelectWord(
SelectWordSelectionEvent event) → SelectionResult -
Selects a word in a Selectable at the location
SelectWordSelectionEvent.globalPosition.
override
-
layoutDidChange(
) → void -
Notifies this delegate that layout of the container has changed.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
pushHandleLayers(
LayerLink? startHandle, LayerLink? endHandle) → void -
Marks this handler to be responsible for pushing LeaderLayers for the
selection handles.
inherited
-
remove(
Selectable selectable) → void -
Removes the
selectable
from the registrar.override -
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.
inherited
-
updateLastSelectionEdgeLocation(
{required Offset globalSelectionEdgeLocation, required bool forEnd}) → void -
Updates the last selection edge location of the edge specified by
forEnd
to the providedglobalSelectionEdgeLocation
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited