Skip to content

Commit

Permalink
fix: launch url
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuel-braz committed Apr 12, 2024
1 parent 753fec5 commit d45463d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/presentation/home/home_view/mobile_view.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../../data/social_qr_code.dart';
import '../event_store.dart';
Expand Down Expand Up @@ -36,7 +36,7 @@ class ListTileWidget extends StatelessWidget {
return MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () => launchUrlString(socialQrCode.qrCode),
onTap: () => launch(socialQrCode.qrCode),
child: Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
Expand All @@ -62,4 +62,11 @@ class ListTileWidget extends StatelessWidget {
),
);
}

Future<void> launch(String url, {bool isNewTab = true}) async {
await launchUrl(
Uri.parse(url),
webOnlyWindowName: isNewTab ? '_blank' : '_self',
);
}
}

0 comments on commit d45463d

Please sign in to comment.