Skip to content

Commit 13e04ad

Browse files
RZEROSTERNCopilot
andauthored
Update lib/src/presentation/blocks/embed/embed_renderer.dart
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent fd1190c commit 13e04ad

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

lib/src/presentation/blocks/embed/embed_renderer.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,18 @@ class EmbedRenderer extends BlockRenderer<EmbedBlock> {
1111
Widget build(BuildContext context) {
1212
return InkWell(
1313
onTap: block.source.isNotEmpty
14-
? () => launchUrl(Uri.parse(block.source),
15-
mode: LaunchMode.externalApplication)
14+
? () async {
15+
final uri = Uri.tryParse(block.source);
16+
if (uri == null) return;
17+
final scheme = uri.scheme.toLowerCase();
18+
if (scheme != 'http' && scheme != 'https') return;
19+
if (await canLaunchUrl(uri)) {
20+
await launchUrl(
21+
uri,
22+
mode: LaunchMode.externalApplication,
23+
);
24+
}
25+
}
1626
: null,
1727
borderRadius: BorderRadius.circular(8),
1828
child: Container(

0 commit comments

Comments
 (0)