Skip to content

Commit 01e4835

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

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

lib/src/presentation/blocks/link_tool/link_tool_renderer.dart

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,21 @@ class LinkToolRenderer extends BlockRenderer<LinkToolBlock> {
1414

1515
return InkWell(
1616
onTap: block.link.isNotEmpty
17-
? () => launchUrl(Uri.parse(block.link),
18-
mode: LaunchMode.externalApplication)
17+
? () async {
18+
final uri = Uri.tryParse(block.link);
19+
if (uri == null) {
20+
return;
21+
}
22+
if (uri.scheme != 'http' && uri.scheme != 'https') {
23+
return;
24+
}
25+
if (await canLaunchUrl(uri)) {
26+
await launchUrl(
27+
uri,
28+
mode: LaunchMode.externalApplication,
29+
);
30+
}
31+
}
1932
: null,
2033
borderRadius: BorderRadius.circular(8),
2134
child: Container(

0 commit comments

Comments
 (0)