We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 01e4835 + e49c87a commit 6f56057Copy full SHA for 6f56057
1 file changed
lib/src/presentation/blocks/attaches/attaches_renderer.dart
@@ -16,8 +16,15 @@ class AttachesRenderer extends BlockRenderer<AttachesBlock> {
16
17
return InkWell(
18
onTap: block.url.isNotEmpty
19
- ? () => launchUrl(Uri.parse(block.url),
20
- mode: LaunchMode.externalApplication)
+ ? () async {
+ final uri = Uri.tryParse(block.url);
21
+ if (uri == null) return;
22
+ final scheme = uri.scheme.toLowerCase();
23
+ if (scheme != 'http' && scheme != 'https') return;
24
+ if (await canLaunchUrl(uri)) {
25
+ await launchUrl(uri, mode: LaunchMode.externalApplication);
26
+ }
27
28
: null,
29
borderRadius: BorderRadius.circular(8),
30
child: Container(
0 commit comments