SebastienBtr/Dash-Chat-2

How to select text/copy messages to clipboard?

Closed this issue · 3 comments

Hello, I am having issues copying the text from messages to the clipboard. What is the best practice for this?

I have tried wrapping my DashChat inside a SelectableArea() and also using Clipboard.setData() with no luck. Any advice would be appreciated!

What works for me is the following:

onLongPressMessage: (ChatMessage message) => Clipboard.setData(ClipboardData(text: message.text))

I'm showing a bottom sheet to let the user select the "copy" option but that's the same

I'm closing it, let me know if you need more help

Hi @SebastienBtr

I am having issues implementing this, where would I place:

onLongPressMessage: (ChatMessage message) => Clipboard.setData(ClipboardData(text: message.text))

Also, could I apply this to an icon next to the text of the avatar icon?

Could I see an example even of: "I'm showing a bottom sheet to let the user select the "copy" option but that's the same"

Any help would be greatly appreciated.