2000calories / flutter_easy_rich_text

The EasyRichText widget provides an easy way to use RichText.
https://pub.dev/packages/easy_rich_text
MIT License
80 stars 33 forks source link

Text copy unavailable #54

Closed zthrive closed 7 months ago

zthrive commented 9 months ago

You can select the text but you cannot copy it to the clipboard

2000calories commented 7 months ago

I have no idea why the default selectable text behaviour change, but you try the contextMenuBuilder below.

EasyRichText(
  "This paragraph is selectable...",
  selectable: true,
  contextMenuBuilder: (context, editableTextState) {
    return AdaptiveTextSelectionToolbar.buttonItems(
      anchors: editableTextState.contextMenuAnchors,
      buttonItems: <ContextMenuButtonItem>[
        ContextMenuButtonItem(
          onPressed: () {
            editableTextState
                .copySelection(SelectionChangedCause.toolbar);
          },
          type: ContextMenuButtonType.copy,
        ),
        ContextMenuButtonItem(
          onPressed: () {
            editableTextState
                .selectAll(SelectionChangedCause.toolbar);
          },
          type: ContextMenuButtonType.selectAll,
        ),
      ],
    );
  },
),
zthrive commented 7 months ago

Thank you for the update. It works now :).

Have a nice day.

Best

On Fri, 5 Apr 2024 at 14:43, hans.huang @.***> wrote:

I have no idea why the default selectable text behaviour change, but you try the contextMenuBuilder below.

EasyRichText( "This paragraph is selectable...", selectable: true, contextMenuBuilder: (context, editableTextState) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: editableTextState.contextMenuAnchors, buttonItems: [ ContextMenuButtonItem( onPressed: () { editableTextState .copySelection(SelectionChangedCause.toolbar); }, type: ContextMenuButtonType.copy, ), ContextMenuButtonItem( onPressed: () { editableTextState .selectAll(SelectionChangedCause.toolbar); }, type: ContextMenuButtonType.selectAll, ), ], ); }, ),

— Reply to this email directly, view it on GitHub https://github.com/2000calories/flutter_easy_rich_text/issues/54#issuecomment-2038810471, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDUBCLBHCUZXC6RPWAZIFLY3YMWBAVCNFSM6AAAAABB4PROXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZYHAYTANBXGE . You are receiving this because you authored the thread.Message ID: @.***>