From 67753a06c527caee4048d6d3410975bc4d07712b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 15 Jan 2021 16:08:38 +0530 Subject: [PATCH] [MessageWidget] Show only max 2 thread participants Signed-off-by: Sahil Kumar --- lib/src/message_widget.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index fb436e5b..65817823 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -522,7 +522,7 @@ class _MessageWidgetState extends State { var children = []; - final threadParticipants = widget.message.threadParticipants; + final threadParticipants = widget.message?.threadParticipants?.take(2); final showThreadParticipants = threadParticipants?.isNotEmpty == true; final replyCount = widget.message.replyCount; @@ -551,7 +551,7 @@ class _MessageWidgetState extends State { if (showThreadParticipants) SizedBox.fromSize( size: Size((threadParticipants.length * 8.0) + 8, 16), - child: _buildThreadParticipantsIndicator(), + child: _buildThreadParticipantsIndicator(threadParticipants), ), InkWell( onTap: widget.onThreadTap != null ? onThreadTap : null, @@ -628,10 +628,10 @@ class _MessageWidgetState extends State { ); } - Widget _buildThreadParticipantsIndicator() { + Widget _buildThreadParticipantsIndicator(Iterable threadParticipants) { var padding = 0.0; return Stack( - children: widget.message.threadParticipants.map((user) { + children: threadParticipants.map((user) { padding += 8.0; return Positioned( right: padding - 8,