onTapHyperLink function
void
onTapHyperLink(
- BuildContext context,
- LinkableElement link
)
Implementation
void onTapHyperLink(
BuildContext context,
LinkableElement link,
) {
showLongPressDialogButton(
context,
buttons: [
LongPressDialogButton(
button: Button(
name: "Open",
onPressed: () {
if (ScaffoldMessenger.of(context).mounted) {
ScaffoldMessenger.of(context).clearSnackBars();
}
Navigator.pop(context);
launchUrl(Uri.parse(link.url));
},
),
),
LongPressDialogButton(
button: Button(
name: "Copy Link",
onPressed: () {
if (ScaffoldMessenger.of(context).mounted) {
ScaffoldMessenger.of(context).clearSnackBars();
}
Navigator.pop(context);
Clipboard.setData(ClipboardData(text: link.url));
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text("Link has been copied"),
duration: Duration(seconds: 2),
));
},
),
),
],
);
}