build: update url_launcher

This commit is contained in:
Rongjian Zhang 2022-06-26 14:23:50 +08:00
parent bad5327928
commit 8114cff317
8 changed files with 28 additions and 14 deletions

View File

@ -742,7 +742,7 @@ class AuthModel with ChangeNotifier {
final repoScope = publicOnly ? 'public_repo' : 'repo'; final repoScope = publicOnly ? 'public_repo' : 'repo';
final scope = Uri.encodeComponent( final scope = Uri.encodeComponent(
['user', repoScope, 'read:org', 'notifications'].join(',')); ['user', repoScope, 'read:org', 'notifications'].join(','));
launchUrl( launchStringUrl(
'https://github.com/login/oauth/authorize?client_id=$clientId&redirect_uri=gittouch://login&scope=$scope&state=$_oauthState', 'https://github.com/login/oauth/authorize?client_id=$clientId&redirect_uri=gittouch://login&scope=$scope&state=$_oauthState',
); );
} }

View File

@ -259,7 +259,7 @@ class ThemeModel with ChangeNotifier {
replace: replace, replace: replace,
); );
} else { } else {
launchUrl(url); launchStringUrl(url);
} }
} }

View File

@ -149,7 +149,7 @@ class _User extends StatelessWidget {
leftIconData: Octicons.location, leftIconData: Octicons.location,
text: Text(p!.location!), text: Text(p!.location!),
onTap: () { onTap: () {
launchUrl('https://www.google.com/maps/place/' + launchStringUrl('https://www.google.com/maps/place/' +
p!.location!.replaceAll(RegExp(r'\s+'), '')); p!.location!.replaceAll(RegExp(r'\s+'), ''));
}, },
), ),
@ -158,7 +158,7 @@ class _User extends StatelessWidget {
leftIconData: Octicons.mail, leftIconData: Octicons.mail,
text: Text(p!.email), text: Text(p!.email),
onTap: () { onTap: () {
launchUrl('mailto:' + p!.email); launchStringUrl('mailto:' + p!.email);
}, },
), ),
if (isNotNullOrEmpty(p!.websiteUrl)) if (isNotNullOrEmpty(p!.websiteUrl))
@ -170,7 +170,7 @@ class _User extends StatelessWidget {
if (!url.startsWith('http')) { if (!url.startsWith('http')) {
url = 'http://$url'; url = 'http://$url';
} }
launchUrl(url); launchStringUrl(url);
}, },
), ),
], ],
@ -227,7 +227,7 @@ class _Org extends StatelessWidget {
leftIconData: Octicons.location, leftIconData: Octicons.location,
text: Text(p!.location!), text: Text(p!.location!),
onTap: () { onTap: () {
launchUrl('https://www.google.com/maps/place/' + launchStringUrl('https://www.google.com/maps/place/' +
p!.location!.replaceAll(RegExp(r'\s+'), '')); p!.location!.replaceAll(RegExp(r'\s+'), ''));
}, },
), ),
@ -236,7 +236,7 @@ class _Org extends StatelessWidget {
leftIconData: Octicons.mail, leftIconData: Octicons.mail,
text: Text(p!.email!), text: Text(p!.email!),
onTap: () { onTap: () {
launchUrl('mailto:' + p!.email!); launchStringUrl('mailto:' + p!.email!);
}, },
), ),
if (isNotNullOrEmpty(p!.websiteUrl)) if (isNotNullOrEmpty(p!.websiteUrl))
@ -248,7 +248,7 @@ class _Org extends StatelessWidget {
if (!url.startsWith('http')) { if (!url.startsWith('http')) {
url = 'http://$url'; url = 'http://$url';
} }
launchUrl(url); launchStringUrl(url);
}, },
), ),
], ],

View File

@ -167,7 +167,7 @@ class PrimerBranchName extends StatelessWidget {
} }
} }
launchUrl(String? url) async { launchStringUrl(String? url) async {
if (url == null) return; if (url == null) return;
if (await canLaunch(url)) { if (await canLaunch(url)) {

View File

@ -33,7 +33,7 @@ class ActionItem {
text: 'Open in Browser', text: 'Open in Browser',
iconData: Octicons.globe, iconData: Octicons.globe,
onTap: (_) { onTap: (_) {
launchUrl(url); launchStringUrl(url);
}, },
), ),
]; ];

View File

@ -67,7 +67,7 @@ class _HtmlViewState extends State<HtmlView> {
}, },
navigationDelegate: (request) { navigationDelegate: (request) {
if (loaded) { if (loaded) {
launchUrl(request.url); // TODO: launchStringUrl(request.url); // TODO:
return NavigationDecision.prevent; return NavigationDecision.prevent;
} else { } else {
loaded = true; loaded = true;

View File

@ -155,7 +155,7 @@ class MarkdownFlutterView extends StatelessWidget {
} }
} }
launchUrl(url); launchStringUrl(url);
}, },
styleSheet: MarkdownStyleSheet( styleSheet: MarkdownStyleSheet(
a: _basicStyle.copyWith(color: theme.palette.primary), a: _basicStyle.copyWith(color: theme.palette.primary),

View File

@ -970,7 +970,21 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.9" version: "6.1.3"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.17"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.17"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
@ -1071,4 +1085,4 @@ packages:
version: "3.1.0" version: "3.1.0"
sdks: sdks:
dart: ">=2.17.5 <3.0.0" dart: ">=2.17.5 <3.0.0"
flutter: ">=2.0.0" flutter: ">=2.8.0"