From 3b1df38e2758b494b2b2036eb0275a85de3a9f4f Mon Sep 17 00:00:00 2001 From: guoshuyu <359369982@qq.com> Date: Wed, 3 Jul 2024 11:38:25 +0800 Subject: [PATCH] change launch url func --- lib/common/utils/common_utils.dart | 8 ++++---- lib/page/release/release_page.dart | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/common/utils/common_utils.dart b/lib/common/utils/common_utils.dart index f23a0019..9ab6fd05 100644 --- a/lib/common/utils/common_utils.dart +++ b/lib/common/utils/common_utils.dart @@ -383,7 +383,7 @@ class CommonUtils { static launchOutURL(String? url, BuildContext context) async { var gl = GSYLocalizations.i18n(context); if (url != null && await canLaunchUrl(Uri.parse(url))) { - await launchUrl(Uri.parse(url)); + await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication); } else { Fluttertoast.showToast( msg: "${gl!.option_web_launcher_error}: ${url ?? ""}"); @@ -413,8 +413,7 @@ class CommonUtils { children: [ const SpinKitCubeGrid(color: GSYColors.white), Container(height: 10.0), - Text( - GSYLocalizations.i18n(context)!.loading_text, + Text(GSYLocalizations.i18n(context)!.loading_text, style: GSYConstant.normalTextWhite), ], ), @@ -516,7 +515,8 @@ class CommonUtils { child: Text(GSYLocalizations.i18n(context)!.app_cancel)), TextButton( onPressed: () { - launchUrl(Uri.parse(Address.updateUrl)); + launchUrl(Uri.parse(Address.updateUrl), + mode: LaunchMode.externalApplication); Navigator.pop(context); }, child: Text(GSYLocalizations.i18n(context)!.app_ok)), diff --git a/lib/page/release/release_page.dart b/lib/page/release/release_page.dart index f9608dd6..47751271 100644 --- a/lib/page/release/release_page.dart +++ b/lib/page/release/release_page.dart @@ -24,7 +24,8 @@ class ReleasePage extends StatefulWidget { final String releaseUrl; final String tagUrl; - const ReleasePage(this.userName, this.reposName, this.releaseUrl, this.tagUrl, {super.key}); + const ReleasePage(this.userName, this.reposName, this.releaseUrl, this.tagUrl, + {super.key}); @override _ReleasePageState createState() => _ReleasePageState(); @@ -65,10 +66,9 @@ class _ReleasePageState extends State String url = _getUrl(); var gl = GSYLocalizations.i18n(context); if (await canLaunchUrl(Uri.parse(url))) { - await launchUrl(Uri.parse(url)); + await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication); } else { - Fluttertoast.showToast( - msg: "${gl!.option_web_launcher_error}: $url"); + Fluttertoast.showToast(msg: "${gl!.option_web_launcher_error}: $url"); } }