I use the fluter_html package. Is there a way, to make the text Copyable? The Html Widget is in a CustomScrollView with a SliverList. I want to copy the text without the html stuff. As an example, I want to copy "Hello, copy me" and not "Hello <br>
copy me"
Edit: I want to copy on Android and MacOs Desktop This is my Html Widget.
Html(
data: singleNews.text,
style: {
"body": Style(
fontSize: FontSize(
(MediaQuery.of(context).size.width) / 70),
)
},
onLinkTap: (url, _, __, ___) async {
if (await canLaunch(url!)) {
await launch(url);
_log.i("Opening $url...");
} else {
_log.e('Could not launch $url');
}
},
),
From looking at the docs it looks like the package has a 'Selectable' option, so just change your widget from Html
to SelectableHtml
, which will give you the desired function, you will be able to select the text and a tooltip will appear with the 'Copy' option.
https://pub.dev/documentation/flutter_html/latest/flutter_html/SelectableHtml-class.html