From d420bfc4b7c1699b7df8a1eb6d295b1835a26108 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Mon, 06 Apr 2026 15:36:25 +0200
Subject: [PATCH] fix: markdown links open in browser/app instead of copying to clipboard
---
ios/Podfile.lock | 6 ++++++
macos/Flutter/GeneratedPluginRegistrant.swift | 2 ++
lib/widgets/message_bubble.dart | 12 +++++-------
pubspec.lock | 32 ++++++++++++++++++++++++++++++++
pubspec.yaml | 1 +
5 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 12a2822..06efee0 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -69,6 +69,8 @@
- Flutter
- FlutterMacOS
- SwiftyGif (5.4.5)
+ - url_launcher_ios (0.0.1):
+ - Flutter
- vibration (1.7.5):
- Flutter
@@ -88,6 +90,7 @@
- record_ios (from `.symlinks/plugins/record_ios/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
+ - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- vibration (from `.symlinks/plugins/vibration/ios`)
SPEC REPOS:
@@ -128,6 +131,8 @@
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
+ url_launcher_ios:
+ :path: ".symlinks/plugins/url_launcher_ios/ios"
vibration:
:path: ".symlinks/plugins/vibration/ios"
@@ -151,6 +156,7 @@
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
+ url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
vibration: 8e2f50fc35bb736f9eecb7dd9f7047fbb6a6e888
PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e
diff --git a/lib/widgets/message_bubble.dart b/lib/widgets/message_bubble.dart
index 7a24e76..da6238a 100644
--- a/lib/widgets/message_bubble.dart
+++ b/lib/widgets/message_bubble.dart
@@ -5,6 +5,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
+import 'package:url_launcher/url_launcher.dart';
import 'package:intl/intl.dart';
import '../models/message.dart';
@@ -165,13 +166,10 @@
),
onTapLink: (text, href, title) {
if (href != null) {
- Clipboard.setData(ClipboardData(text: href));
- ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(
- content: Text('Link copied: $href'),
- duration: const Duration(seconds: 2),
- ),
- );
+ final uri = Uri.tryParse(href);
+ if (uri != null) {
+ launchUrl(uri, mode: LaunchMode.externalApplication);
+ }
}
},
);
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index ba1a8cf..7f61951 100644
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -18,6 +18,7 @@
import record_macos
import share_plus
import shared_preferences_foundation
+import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
@@ -33,4 +34,5 @@
RecordMacOsPlugin.register(with: registry.registrar(forPlugin: "RecordMacOsPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
+ UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
diff --git a/pubspec.lock b/pubspec.lock
index f4a00a3..322567d 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1061,6 +1061,30 @@
url: "https://pub.dev"
source: hosted
version: "5.0.3"
+ url_launcher:
+ dependency: "direct main"
+ description:
+ name: url_launcher
+ sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.3.2"
+ url_launcher_android:
+ dependency: transitive
+ description:
+ name: url_launcher_android
+ sha256: "3bb000251e55d4a209aa0e2e563309dc9bb2befea2295fd0cec1f51760aac572"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.3.29"
+ url_launcher_ios:
+ dependency: transitive
+ description:
+ name: url_launcher_ios
+ sha256: "580fe5dfb51671ae38191d316e027f6b76272b026370708c2d898799750a02b0"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.4.1"
url_launcher_linux:
dependency: transitive
description:
@@ -1069,6 +1093,14 @@
url: "https://pub.dev"
source: hosted
version: "3.2.2"
+ url_launcher_macos:
+ dependency: transitive
+ description:
+ name: url_launcher_macos
+ sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.2.5"
url_launcher_platform_interface:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index c941a09..dd5c28e 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -35,6 +35,7 @@
flutter_app_badger: ^1.5.0
connectivity_plus: ^7.1.0
in_app_purchase: ^3.2.3
+ url_launcher: ^6.3.2
dev_dependencies:
flutter_test:
--
Gitblit v1.3.1