2024-04-13 11:47:31 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
|
|
|
import 'package:solian/models/post.dart';
|
2024-04-15 15:08:32 +00:00
|
|
|
import 'package:url_launcher/url_launcher_string.dart';
|
2024-04-13 11:47:31 +00:00
|
|
|
|
|
|
|
class MomentContent extends StatelessWidget {
|
|
|
|
final Post item;
|
|
|
|
final bool brief;
|
|
|
|
|
|
|
|
const MomentContent({super.key, required this.brief, required this.item});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Markdown(
|
|
|
|
selectable: !brief,
|
|
|
|
data: item.content,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
2024-04-13 17:45:27 +00:00
|
|
|
padding: const EdgeInsets.all(0),
|
2024-04-15 15:08:32 +00:00
|
|
|
onTapLink: (text, href, title) async {
|
|
|
|
if (href == null) return;
|
|
|
|
await launchUrlString(
|
|
|
|
href,
|
|
|
|
mode: LaunchMode.externalApplication,
|
|
|
|
);
|
|
|
|
},
|
2024-04-13 11:47:31 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|