onSetSelection property

SetSelectionHandler onSetSelection

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;
void onSetSelection= (SetSelectionHandler value)

Implementation

set onSetSelection(SetSelectionHandler value) {
  assert(value != null);
  _addAction(SemanticsAction.setSelection, (dynamic args) {
    final Map<String, int> selection = args;
    assert(selection != null && selection['base'] != null && selection['extent'] != null);
    value(TextSelection(
      baseOffset: selection['base'],
      extentOffset: selection['extent'],
    ));
  });
  _onSetSelection = value;
}