SmoothSelectionRegion class

A thin SelectableRegion adapter that exposes programmatic selection control.

The widget keeps Flutter's built-in selection overlay, gestures, shortcuts, handles, magnifier, and toolbar. It adds a stable controller/state surface for selecting all content, selecting a word or paragraph at a press position, and dispatching lower-level SelectionEvents to the underlying SelectionContainer.

Example:

final controller = SmoothSelectionController();

SmoothMarkdown(
  data: markdownText,
  selectable: true,
  selectionController: controller,
)

// Programmatic select-all (shows handles + toolbar):
controller.selectAll(SelectionChangedCause.toolbar);

// Lower-level: dispatch an arbitrary SelectionEvent straight to the
// SelectionContainer (fans out to every text selectable). Does not, by
// itself, drive the overlay.
controller.dispatchEvent(const SelectAllSelectionEvent());
Inheritance

Constructors

SmoothSelectionRegion({required Widget child, Key? key, FocusNode? focusNode, TextSelectionControls? selectionControls, TextMagnifierConfiguration? magnifierConfiguration, ValueChanged<SelectedContent?>? onSelectionChanged, SmoothSelectionContextMenuBuilder? contextMenuBuilder, SmoothSelectionController? controller})
Creates a SmoothSelectionRegion.
const

Properties

child Widget
The child widget this selection region applies to.
final
contextMenuBuilder SmoothSelectionContextMenuBuilder?
Custom context menu builder. Receives a SmoothSelectionRegionState.
final
controller SmoothSelectionController?
Optional controller for driving selection without a GlobalKey.
final
focusNode FocusNode?
An optional focus node to use as the focus node for this widget.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
magnifierConfiguration TextMagnifierConfiguration?
The configuration for the magnifier used with selections in this region.
final
onSelectionChanged ValueChanged<SelectedContent?>?
Called when the selected content changes.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionControls TextSelectionControls?
The delegate to build the selection handles and toolbar for mobile devices.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<SmoothSelectionRegion>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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