copySelection method

  1. @override
void copySelection(
  1. SelectionChangedCause cause
)
override

Copy current selection to Clipboard.

If cause is SelectionChangedCause.toolbar, the position of bringIntoView to selection will be called and hide toolbar.

Implementation

@override
void copySelection(SelectionChangedCause cause) {
  final selection = textEditingValue.selection;
  final plainText = textEditingValue.text;
  if (selection.isCollapsed) {
    return;
  }
  clipboardController.copy(widget.controller, plainText);
  if (cause == SelectionChangedCause.toolbar) {
    bringIntoView(textEditingValue.selection.extent);
    hideToolbar();
  }
}