Solian/lib/widgets/chat/message_content.dart

29 lines
781 B
Dart
Raw Normal View History

2024-04-17 15:00:53 +00:00
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:solian/models/message.dart';
import 'package:url_launcher/url_launcher_string.dart';
class ChatMessageContent extends StatelessWidget {
final Message item;
const ChatMessageContent({super.key, required this.item});
@override
Widget build(BuildContext context) {
return Markdown(
data: item.content,
shrinkWrap: true,
2024-05-01 11:39:48 +00:00
selectable: true,
2024-04-17 15:00:53 +00:00
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.all(0),
onTapLink: (text, href, title) async {
if (href == null) return;
await launchUrlString(
href,
mode: LaunchMode.externalApplication,
);
},
);
}
}