[MessageWidget] Show only max 2 thread participants

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-01-15 16:08:38 +05:30
parent 006b3e21c3
commit 67753a06c5
+4 -4
View File
@@ -522,7 +522,7 @@ class _MessageWidgetState extends State<MessageWidget> {
var children = <Widget>[]; var children = <Widget>[];
final threadParticipants = widget.message.threadParticipants; final threadParticipants = widget.message?.threadParticipants?.take(2);
final showThreadParticipants = threadParticipants?.isNotEmpty == true; final showThreadParticipants = threadParticipants?.isNotEmpty == true;
final replyCount = widget.message.replyCount; final replyCount = widget.message.replyCount;
@@ -551,7 +551,7 @@ class _MessageWidgetState extends State<MessageWidget> {
if (showThreadParticipants) if (showThreadParticipants)
SizedBox.fromSize( SizedBox.fromSize(
size: Size((threadParticipants.length * 8.0) + 8, 16), size: Size((threadParticipants.length * 8.0) + 8, 16),
child: _buildThreadParticipantsIndicator(), child: _buildThreadParticipantsIndicator(threadParticipants),
), ),
InkWell( InkWell(
onTap: widget.onThreadTap != null ? onThreadTap : null, onTap: widget.onThreadTap != null ? onThreadTap : null,
@@ -628,10 +628,10 @@ class _MessageWidgetState extends State<MessageWidget> {
); );
} }
Widget _buildThreadParticipantsIndicator() { Widget _buildThreadParticipantsIndicator(Iterable<User> threadParticipants) {
var padding = 0.0; var padding = 0.0;
return Stack( return Stack(
children: widget.message.threadParticipants.map((user) { children: threadParticipants.map((user) {
padding += 8.0; padding += 8.0;
return Positioned( return Positioned(
right: padding - 8, right: padding - 8,