Add markdown rendering to comments
This commit is contained in:
parent
2ca3565bfc
commit
cf3862d2e2
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'comment_tree.dart';
|
import 'comment_tree.dart';
|
||||||
|
import 'markdown_text.dart';
|
||||||
|
|
||||||
class CommentWidget extends StatelessWidget {
|
class CommentWidget extends StatelessWidget {
|
||||||
final int indent;
|
final int indent;
|
||||||
|
@ -13,6 +14,23 @@ class CommentWidget extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var comment = commentTree.comment;
|
var comment = commentTree.comment;
|
||||||
|
var body;
|
||||||
|
if (comment.deleted) {
|
||||||
|
body = Flexible(
|
||||||
|
child: Text(
|
||||||
|
'comment deleted by creator',
|
||||||
|
style: TextStyle(fontStyle: FontStyle.italic),
|
||||||
|
));
|
||||||
|
} else if (comment.removed) {
|
||||||
|
body = Flexible(
|
||||||
|
child: Text(
|
||||||
|
'comment deleted by moderator',
|
||||||
|
style: TextStyle(fontStyle: FontStyle.italic),
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
body =
|
||||||
|
Flexible(child: MarkdownText(commentTree.comment.content, context));
|
||||||
|
}
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
|
@ -23,9 +41,7 @@ class CommentWidget extends StatelessWidget {
|
||||||
Spacer(),
|
Spacer(),
|
||||||
Text(comment.score.toString()),
|
Text(comment.score.toString()),
|
||||||
]),
|
]),
|
||||||
Row(children: [
|
Row(children: [body]),
|
||||||
Flexible(child: Text(commentTree.comment.content)),
|
|
||||||
]),
|
|
||||||
Row(children: [
|
Row(children: [
|
||||||
Spacer(),
|
Spacer(),
|
||||||
// actions go here
|
// actions go here
|
||||||
|
|
Loading…
Reference in New Issue