From 4fefb3fd3293f9d9332da809ce8ceb64efef6d7d Mon Sep 17 00:00:00 2001 From: Zryte Date: Wed, 5 Jun 2024 15:08:30 +0700 Subject: [PATCH] feat: Update UI for reaction creator (#228) * Update UI for reaction's creator * Fix error --------- Co-authored-by: Zryte --- lib/core/widget/feed_widget.dart | 25 +++++++++++-------------- lib/core/widget/reaction_widget.dart | 23 ++++++++++++++++++----- pubspec.yaml | 2 +- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/lib/core/widget/feed_widget.dart b/lib/core/widget/feed_widget.dart index 50b3254..4abb212 100644 --- a/lib/core/widget/feed_widget.dart +++ b/lib/core/widget/feed_widget.dart @@ -34,7 +34,6 @@ class FeedWidget extends StatelessWidget { @override Widget build(BuildContext context) { final themeData = Theme.of(context); - return StreamBuilder( stream: amityPost.listen.stream, @@ -148,20 +147,19 @@ class FeedWidget extends StatelessWidget { style: themeData.textTheme.bodySmall, ), if (value.target is CommunityTarget) - Text( 'Posted On : ${(value.target as CommunityTarget).targetCommunity?.displayName ?? 'No name'} Community', style: themeData.textTheme.bodySmall, ), - - (value.target as CommunityTarget).postedCommunityMember!=null? - - Text( - 'Poster Roles On : ${(value.target as CommunityTarget).postedCommunityMember?.roles ?? 'No Roles'} in Community', - style: themeData.textTheme.bodySmall, - ): const SizedBox() , - - + if (value.target is CommunityTarget) + (value.target as CommunityTarget) + .postedCommunityMember != + null + ? Text( + 'Poster Roles On : ${(value.target as CommunityTarget).postedCommunityMember?.roles ?? 'No Roles'} in Community', + style: themeData.textTheme.bodySmall, + ) + : const SizedBox(), Text( "LatestCommentUserName -> ${snapshot.data!.latestComments?[0].user?.displayName ?? "No Latest comment user"}", style: themeData.textTheme.bodySmall, @@ -229,8 +227,7 @@ class FeedWidget extends StatelessWidget { ), GestureDetector( onTap: () { - GoRouter.of(context).pushNamed( - AppRoute.getReachUser, + GoRouter.of(context).pushNamed(AppRoute.getReachUser, queryParams: { 'referenceId': value.postId!, 'referenceType': "post" @@ -257,7 +254,7 @@ class FeedWidget extends StatelessWidget { GoRouter.of(context).pushNamed( AppRoute.commentList, queryParams: { - 'referenceType' : 'post', + 'referenceType': 'post', 'referenceId': value.postId!, 'communityId': communityId, 'isPublic': isPublic.toString() diff --git a/lib/core/widget/reaction_widget.dart b/lib/core/widget/reaction_widget.dart index f994e4a..d81143d 100644 --- a/lib/core/widget/reaction_widget.dart +++ b/lib/core/widget/reaction_widget.dart @@ -14,6 +14,23 @@ class ReactionWidget extends StatelessWidget { color: Colors.black12), child: Row( children: [ + Container( + width: 36, + height: 36, + decoration: BoxDecoration( + shape: BoxShape.circle, color: Colors.grey.withOpacity(.3)), + clipBehavior: Clip.antiAliasWithSaveLayer, + child: reaction.creator?.avatarUrl != null + ? Image.network( + reaction.creator!.avatarUrl!, + fit: BoxFit.fill, + ) + : Image.asset('assets/user_placeholder.png'), + ), + const SizedBox( + width: 12, + ), + Expanded(child: Text(reaction.creator?.displayName ?? "")), Container( width: 42, height: 42, @@ -25,11 +42,7 @@ class ReactionWidget extends StatelessWidget { reaction.reactionName!, ), ), - ), - const SizedBox( - width: 12, - ), - Text(reaction.userDisplayName ?? "") + ) ], ), ); diff --git a/pubspec.yaml b/pubspec.yaml index b3fde1b..a67f398 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_social_sample_app description: Demonstrates how to use the flutter_application_1 plugin. -version: 1.1.44+59 +version: 1.1.45+60 environment: