url launching with feedback refactored

This commit is contained in:
Fabian Freund
2024-06-05 15:56:39 +02:00
parent eb6a4b9f87
commit b8100b1823
4 changed files with 25 additions and 26 deletions
@@ -172,17 +172,8 @@ class KagiScreen extends HookConsumerWidget {
onPressed: () async {
final url = await webViewController.value?.getUrl();
if (url != null) {
if (!await launchUrl(
url,
mode: LaunchMode.externalApplication,
)) {
if (context.mounted) {
ui_helper.showErrorMessage(
context,
'Could not launch URL ($url)',
);
}
}
// ignore: use_build_context_synchronously
await ui_helper.launchUrlFeedback(context, url);
}
},
leadingIcon: const Icon(Icons.open_in_browser),