1
0
mirror of https://github.com/krawieck/lemmur/ synced 2024-12-17 19:09:07 +01:00
lemmur-app-android/lib/widgets/markdown_text.dart

24 lines
662 B
Dart

import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:markdown/markdown.dart' as md;
import '../url_launcher.dart';
Widget MarkdownText(String text, BuildContext context) {
return MarkdownBody(
data: text,
extensionSet: md.ExtensionSet.gitHubWeb,
onTapLink: (href) {
urlLauncher(href)
.catchError((e) => Scaffold.of(context).showSnackBar(SnackBar(
content: Row(
children: [
Icon(Icons.warning),
Text('couldn\'t open link'),
],
),
)));
},
);
}