copySelection method

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

Copy current selection to Clipboard.

Implementation

@override
void copySelection(SelectionChangedCause cause) {
  if (!controller.clipboardSelection(true)) return;

  if (cause == SelectionChangedCause.toolbar) {
    bringIntoView(textEditingValue.selection.extent);
    hideToolbar();

    // Collapse the selection and hide the toolbar and handles.
    userUpdateTextEditingValue(
      TextEditingValue(
        text: textEditingValue.text,
        selection:
            TextSelection.collapsed(offset: textEditingValue.selection.end),
      ),
      SelectionChangedCause.toolbar,
    );
  }
}