getEditableButtonItems static method

List<ContextMenuButtonItem> getEditableButtonItems(
  1. {required ClipboardStatus? clipboardStatus,
  2. required VoidCallback? onCopy,
  3. required VoidCallback? onCut,
  4. required VoidCallback? onPaste,
  5. required VoidCallback? onSelectAll,
  6. required VoidCallback? onLookUp,
  7. required VoidCallback? onSearchWeb,
  8. required VoidCallback? onShare,
  9. required VoidCallback? onLiveTextInput}

Returns the ContextMenuButtonItems representing the buttons in this platform's default selection menu for an editable field.

For example, EditableText uses this to generate the default buttons for its context menu.

See also:


static List<ContextMenuButtonItem> getEditableButtonItems({
  required final ClipboardStatus? clipboardStatus,
  required final VoidCallback? onCopy,
  required final VoidCallback? onCut,
  required final VoidCallback? onPaste,
  required final VoidCallback? onSelectAll,
  required final VoidCallback? onLookUp,
  required final VoidCallback? onSearchWeb,
  required final VoidCallback? onShare,
  required final VoidCallback? onLiveTextInput,
}) {
  final List<ContextMenuButtonItem> resultButtonItem = <ContextMenuButtonItem>[];

  // Configure button items with clipboard.
  if (onPaste == null || clipboardStatus != ClipboardStatus.unknown) {
    // If the paste button is enabled, don't render anything until the state
    // of the clipboard is known, since it's used to determine if paste is
    // shown.

    // On Android, the share button is before the select all button.
    final bool showShareBeforeSelectAll = defaultTargetPlatform ==;

      if (onCut != null)
          onPressed: onCut,
          type: ContextMenuButtonType.cut,
      if (onCopy != null)
          onPressed: onCopy,
          type: ContextMenuButtonType.copy,
      if (onPaste != null)
          onPressed: onPaste,
          type: ContextMenuButtonType.paste,
      if (onShare != null && showShareBeforeSelectAll)
          onPressed: onShare,
          type: ContextMenuButtonType.share,
      if (onSelectAll != null)
          onPressed: onSelectAll,
          type: ContextMenuButtonType.selectAll,
      if (onLookUp != null)
          onPressed: onLookUp,
          type: ContextMenuButtonType.lookUp,
      if (onSearchWeb != null)
          onPressed: onSearchWeb,
          type: ContextMenuButtonType.searchWeb,
      if (onShare != null && !showShareBeforeSelectAll)
          onPressed: onShare,
          type: ContextMenuButtonType.share,

  // Config button items with Live Text.
  if (onLiveTextInput != null) {
      onPressed: onLiveTextInput,
      type: ContextMenuButtonType.liveTextInput,

  return resultButtonItem;