I have this following code, in Flutter for Android
https://gist.github.com/edwinyoyada/0b48c69b46409829a666d30818dbf562
Inside, you see that there is Copy to Clipboard functionality written in JS
But if I click it, the content is not copied.
Please help to make it work,
My previous workaround was to use onPageFinished
onPageFinished: (String url) {
print('Page finished loading: $url');
if (url.contains('#bni') || url.contains('#other_banks')) {
_controller
.evaluateJavascript(
"window.document.body.getElementsByClassName('mb-4 last:mb-0 font-sans font-light text-2xl text-gray-500');")
// .evaluateJavascript(
// "document.documentElement.getElementsByTagName('P')[0].innerText;")
.then((value) {
print(value);
Clipboard.setData(ClipboardData(text: value));
});
}
},
But it's not scalable if i have more than one copy button
Thank you