Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed Open links of About page in browser #270

Closed
wants to merge 11 commits into from
2 changes: 1 addition & 1 deletion lib/ui/components/cv_social_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CircuitVerseSocialCard extends StatelessWidget {
Widget build(BuildContext context) {
return GestureDetector(
onTap: () async {
launchURL(url);
launchURL(url,true);
},
child: Card(
color: Theme.of(context).brightness == Brightness.dark
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/views/about/components/contributor_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ContributorAvatar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => launchURL(contributor.htmlUrl),
onTap: () => launchURL(contributor.htmlUrl, true),
child: Tooltip(
message: contributor.login,
child: Container(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ContributeDonateCard extends StatelessWidget {
const SizedBox(height: 10),
GestureDetector(
onTap: () async {
launchURL(url);
launchURL(url, false);
},
child: Container(
decoration: BoxDecoration(
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/views/ib/ib_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class _IbPageViewState extends State<IbPageView> {
} else {
// Try to navigate to another page using url
// (TODO) We need [IbLandingViewModel] to be able to get Chapter using [httpUrl]
launchURL(href);
launchURL(href, false);
}
}

Expand Down
14 changes: 10 additions & 4 deletions lib/utils/url_launcher.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';

void launchURL(String url) async {
if (await canLaunchUrlString(url)) {
await launchUrlString(url);
void launchURL(String url, bool value) async {
if (url.startsWith('mailto')) {
final url = Uri.parse('mailto:[email protected]');
await launchUrl(url);
Comment on lines +6 to +7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For mail consider to open in external application.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it opens in default mail app of smartphone

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have sent you a video regarding all links on slack, please watch it , it will clear all doubts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then it's fine

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sainideepanshu199 remove the pubspec.lock file

shall i delete the file or revert the changes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just delete the file and commit. It will work.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

} else {
throw 'Could not launch $url';
if (value == true) {
await launchUrlString(url, mode: LaunchMode.externalApplication);
} else {
await launchUrlString(url);
}
}
}
Loading