Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Web - Missing copy option in SelectableText Widget

I am trying to use the Flutter SelectableText Widget to make sure it is possible to copy the Text in my web application, but there is no 'copy' option appearing in the Context Menu.

Context Menu

I am using the following Code ("select all" and "copy" should be given as default toolbar options https://api.flutter.dev/flutter/material/SelectableText/toolbarOptions.html):

SelectableText(
  'Hello from Flutter',
),

Can anyone help me with this problem?

like image 670
AlexanderLipski Avatar asked Mar 17 '20 15:03

AlexanderLipski


People also ask

How do I enable copy text in flutter?

When long tab on Text widget, a tooltip show up with 'copy'. When click on the 'copy' the text content should copy to system clipboard.

How do you make text selectable in flutter?

In Flutter, the text presented by the Text widget is undetectable (even on the web). To make text selectable, you can use the SelectableText widget.


1 Answers

I tried this it's working but we can't select a part of the text but we can select whole.

child: SelectableText(sample.sourceCode,
          cursorColor: Colors.red,
          showCursor: true,
          toolbarOptions: ToolbarOptions(
              copy: true,
              selectAll: true,
              cut: false,
              paste: false
          ),
          style: TextStyle(color: Colors.black, fontStyle: FontStyle.normal))

in web use Ctrl + A and Ctrl + C to copy the whole text.

like image 176
Shailendra Madda Avatar answered Oct 20 '22 22:10

Shailendra Madda