SelectionOverlay class

An object that manages a pair of selection handles and a toolbar.

The selection handles are displayed in the Overlay that most closely encloses the given BuildContext.

Constructors

SelectionOverlay({required BuildContext context, Widget? debugRequiredFor, required TextSelectionHandleType startHandleType, required double lineHeightAtStart, ValueListenable<bool>? startHandlesVisible, ValueChanged<DragStartDetails>? onStartHandleDragStart, ValueChanged<DragUpdateDetails>? onStartHandleDragUpdate, ValueChanged<DragEndDetails>? onStartHandleDragEnd, required TextSelectionHandleType endHandleType, required double lineHeightAtEnd, ValueListenable<bool>? endHandlesVisible, ValueChanged<DragStartDetails>? onEndHandleDragStart, ValueChanged<DragUpdateDetails>? onEndHandleDragUpdate, ValueChanged<DragEndDetails>? onEndHandleDragEnd, ValueListenable<bool>? toolbarVisible, required List<TextSelectionPoint> selectionEndpoints, required TextSelectionControls? selectionControls, @Deprecated('Use `contextMenuBuilder` in `showToolbar` instead. ' 'This feature was deprecated after v3.3.0-0.5.pre.') required TextSelectionDelegate? selectionDelegate, required ClipboardStatusNotifier? clipboardStatus, required LayerLink startHandleLayerLink, required LayerLink endHandleLayerLink, required LayerLink toolbarLayerLink, DragStartBehavior dragStartBehavior = DragStartBehavior.start, VoidCallback? onSelectionHandleTapped, @Deprecated('Use `contextMenuBuilder` in `showToolbar` instead. ' 'This feature was deprecated after v3.3.0-0.5.pre.') Offset? toolbarLocation, TextMagnifierConfiguration magnifierConfiguration = TextMagnifierConfiguration.disabled})
Creates an object that manages overlay entries for selection handles.

Properties

clipboardStatus ClipboardStatusNotifier?
Maintains the status of the clipboard for determining if its contents can be pasted or not.
final
context BuildContext
The context in which the selection UI should appear.
final
debugRequiredFor Widget?
Debugging information for explaining why the Overlay is required.
final
dragStartBehavior DragStartBehavior
Determines the way that drag start behavior is handled.
final
The objects supplied to the CompositedTransformTarget that wraps the location of end selection handle.
final
endHandlesVisible ValueListenable<bool>?
Whether the end handle is visible.
final
endHandleType TextSelectionHandleType
The type of end selection handle.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
lineHeightAtEnd double
The line height at the selection end.
getter/setter pair
lineHeightAtStart double
The line height at the selection start.
getter/setter pair
magnifierConfiguration TextMagnifierConfiguration
The configuration for the magnifier.
final
onEndHandleDragEnd ValueChanged<DragEndDetails>?
Called when the users lift their fingers after dragging the end selection handles.
final
onEndHandleDragStart ValueChanged<DragStartDetails>?
Called when the users start dragging the end selection handles.
final
onEndHandleDragUpdate ValueChanged<DragUpdateDetails>?
Called when the users drag the end selection handles to new locations.
final
onSelectionHandleTapped VoidCallback?
A callback that's optionally invoked when a selection handle is tapped.
final
onStartHandleDragEnd ValueChanged<DragEndDetails>?
Called when the users lift their fingers after dragging the start selection handles.
final
onStartHandleDragStart ValueChanged<DragStartDetails>?
Called when the users start dragging the start selection handles.
final
onStartHandleDragUpdate ValueChanged<DragUpdateDetails>?
Called when the users drag the start selection handles to new locations.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionControls TextSelectionControls?
Builds text selection handles and toolbar.
final
selectionDelegate TextSelectionDelegate?
The delegate for manipulating the current selection in the owning text field.
final
selectionEndpoints List<TextSelectionPoint>
The text selection positions of selection start and end.
getter/setter pair
The objects supplied to the CompositedTransformTarget that wraps the location of start selection handle.
final
startHandlesVisible ValueListenable<bool>?
Whether the start handle is visible.
final
startHandleType TextSelectionHandleType
The type of start selection handle.
getter/setter pair
toolbarIsVisible bool
Whether the toolbar is currently visible.
no setter
The object supplied to the CompositedTransformTarget that wraps the text field.
final
toolbarLocation Offset?
The location of where the toolbar should be drawn in relative to the location of toolbarLayerLink.
getter/setter pair
toolbarVisible ValueListenable<bool>?
Whether the toolbar is visible.
final

Methods

dispose() → void
Disposes this object and release resources.
hide() → void
Hides the entire overlay including the toolbar and the handles.
hideHandles() → void
Destroys the handles by removing them from overlay.
hideMagnifier() → void
Hide the current magnifier.
hideToolbar() → void
Hides the toolbar part of the overlay.
markNeedsBuild() → void
Rebuilds the selection toolbar or handles if they are present.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
showHandles() → void
Builds the handles by inserting them into the context's overlay.
showMagnifier(MagnifierInfo initialMagnifierInfo) → void
Shows the magnifier, and hides the toolbar if it was showing when showMagnifier was called. This is safe to call on platforms not mobile, since a magnifierBuilder will not be provided, or the magnifierBuilder will return null on platforms not mobile.
showSpellCheckSuggestionsToolbar({BuildContext? context, required WidgetBuilder builder}) → void
Shows toolbar with spell check suggestions of misspelled words that are available for click-and-replace.
showToolbar({BuildContext? context, WidgetBuilder? contextMenuBuilder}) → void
Shows the toolbar by inserting it into the context's overlay.
toString() String
A string representation of this object.
inherited
updateMagnifier(MagnifierInfo magnifierInfo) → void
Update the current magnifier with new selection data, so the magnifier can respond accordingly.

Operators

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

Constants

fadeDuration → const Duration
Controls the fade-in and fade-out animations for the toolbar and handles.