diff --git a/lib/components/drawer/quicklinks_listview.dart b/lib/components/drawer/quicklinks_listview.dart index d52a39b5..65f8fa3e 100644 --- a/lib/components/drawer/quicklinks_listview.dart +++ b/lib/components/drawer/quicklinks_listview.dart @@ -31,15 +31,15 @@ class QuicklinksListView extends StatelessWidget { overflow: TextOverflow.ellipsis, ), onTap: () => openUrl(source.url), - onLongPress: () { + onLongPress: () async { Navigator.pop(context); - Clipboard.setData(ClipboardData(text: url)).then((_) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - AppLocalizations.of(context)!.copiedToClipboard)), - ); - }); + await Clipboard.setData(ClipboardData(text: url)); + if (!context.mounted) return; + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: + Text(AppLocalizations.of(context)!.copiedToClipboard)), + ); }, ); }).toList(),