onSetSelection property
The handler for SemanticsAction.setSelection.
This handler is invoked when the user either wants to change the currently selected text in a text field or change the position of the cursor.
TalkBack users can trigger this handler by selecting "Move cursor to beginning/end" or "Select all" from the local context menu.
Implementation
SetSelectionHandler? get onSetSelection => _onSetSelection;
Implementation
set onSetSelection(SetSelectionHandler? value) {
assert(value != null);
_addAction(SemanticsAction.setSelection, (Object? args) {
assert(args != null && args is Map);
final Map<String, int> selection = (args! as Map<dynamic, dynamic>).cast<String, int>();
assert(selection['base'] != null && selection['extent'] != null);
value!(TextSelection(
baseOffset: selection['base']!,
extentOffset: selection['extent']!,
));
});
_onSetSelection = value;
}