onSecondaryTap method Null safety

  1. @protected
void onSecondaryTap()
protected">@protected

Handler for TextSelectionGestureDetector.onSecondaryTap.

By default, selects the word if possible and shows the toolbar.

Implementation

@protected
void onSecondaryTap() {
  if (!delegate.selectionEnabled) {
    return;
  }
  switch (defaultTargetPlatform) {
    case TargetPlatform.iOS:
    case TargetPlatform.macOS:
      if (!_lastSecondaryTapWasOnSelection || !renderEditable.hasFocus) {
        renderEditable.selectWord(cause: SelectionChangedCause.tap);
      }
      if (shouldShowSelectionToolbar) {
        editableText.hideToolbar();
        editableText.showToolbar();
      }
      break;
    case TargetPlatform.android:
    case TargetPlatform.fuchsia:
    case TargetPlatform.linux:
    case TargetPlatform.windows:
      if (!renderEditable.hasFocus) {
        renderEditable.selectPosition(cause: SelectionChangedCause.tap);
      }
      editableText.toggleToolbar();
      break;
  }
}