From cf145658257dd81a824296252acd28ab0380d482 Mon Sep 17 00:00:00 2001 From: niuhuan Date: Tue, 2 Nov 2021 13:07:28 +0800 Subject: [PATCH] display comment liked count --- lib/screens/components/ComicCommentItem.dart | 52 ++++++++++++++------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/lib/screens/components/ComicCommentItem.dart b/lib/screens/components/ComicCommentItem.dart index c8c49b3..acb055f 100644 --- a/lib/screens/components/ComicCommentItem.dart +++ b/lib/screens/components/ComicCommentItem.dart @@ -74,21 +74,43 @@ class ComicCommentItem extends StatelessWidget { Text( "Lv. ${comment.user.level} (${comment.user.title})", style: levelStyle), - comment.commentsCount > 0 - ? Text.rich(TextSpan(children: [ - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon(Icons.message, - size: 13, - color: theme.colorScheme.secondary - .withOpacity(.7)), - ), - WidgetSpan(child: Container(width: 5)), - TextSpan( - text: '${comment.commentsCount}', - style: levelStyle), - ])) - : Container(), + Text.rich(TextSpan( + style: levelStyle, + children: [ + comment.commentsCount > 0 + ? TextSpan(children: [ + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon(Icons.message, + size: 13, + color: theme.colorScheme.secondary + .withOpacity(.7)), + ), + WidgetSpan(child: Container(width: 5)), + TextSpan( + text: '${comment.commentsCount}', + ), + ]) + : TextSpan(), + WidgetSpan(child: Container(width: 12)), + TextSpan(children: [ + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + comment.isLiked + ? Icons.favorite + : Icons.favorite_border, + size: 13, + color: theme.colorScheme.secondary + .withOpacity(.7)), + ), + WidgetSpan(child: Container(width: 5)), + TextSpan( + text: '${comment.likesCount}', + ), + ]), + ], + )), ], ), );