| .. | .. |
|---|
| 5 | 5 | import 'package:flutter/material.dart'; |
|---|
| 6 | 6 | import 'package:flutter/services.dart'; |
|---|
| 7 | 7 | import 'package:flutter_markdown/flutter_markdown.dart'; |
|---|
| 8 | +import 'package:url_launcher/url_launcher.dart'; |
|---|
| 8 | 9 | import 'package:intl/intl.dart'; |
|---|
| 9 | 10 | |
|---|
| 10 | 11 | import '../models/message.dart'; |
|---|
| .. | .. |
|---|
| 165 | 166 | ), |
|---|
| 166 | 167 | onTapLink: (text, href, title) { |
|---|
| 167 | 168 | if (href != null) { |
|---|
| 168 | | - Clipboard.setData(ClipboardData(text: href)); |
|---|
| 169 | | - ScaffoldMessenger.of(context).showSnackBar( |
|---|
| 170 | | - SnackBar( |
|---|
| 171 | | - content: Text('Link copied: $href'), |
|---|
| 172 | | - duration: const Duration(seconds: 2), |
|---|
| 173 | | - ), |
|---|
| 174 | | - ); |
|---|
| 169 | + final uri = Uri.tryParse(href); |
|---|
| 170 | + if (uri != null) { |
|---|
| 171 | + launchUrl(uri, mode: LaunchMode.externalApplication); |
|---|
| 172 | + } |
|---|
| 175 | 173 | } |
|---|
| 176 | 174 | }, |
|---|
| 177 | 175 | ); |
|---|