From 3e1c7872978738a09e94f6289f84bcf54cf25ba4 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 4 May 2022 12:57:58 +0200 Subject: [PATCH 1/2] fix(ui): fix message widget thread indicator in reverse mode --- .../lib/src/message_widget.dart | 71 ++++++++----------- 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/message_widget.dart b/packages/stream_chat_flutter/lib/src/message_widget.dart index caf2722e..ae6e652c 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget.dart @@ -909,17 +909,6 @@ class _StreamMessageWidgetState extends State const usernameKey = Key('username'); children.addAll([ - if (showInChannel || showThreadReplyIndicator) ...[ - if (showThreadParticipants) - SizedBox.fromSize( - size: Size((threadParticipants!.length * 8.0) + 8, 16), - child: _buildThreadParticipantsIndicator(threadParticipants), - ), - InkWell( - onTap: widget.onThreadTap != null ? onThreadTap : null, - child: Text(msg, style: widget.messageTheme.repliesStyle), - ), - ], if (showUsername) _buildUsername(usernameKey), if (showTimeStamp) Text( @@ -932,26 +921,41 @@ class _StreamMessageWidgetState extends State final showThreadTail = !(hasUrlAttachments || isGiphy || isOnlyEmoji) && (showThreadReplyIndicator || showInChannel); + final threadIndicatorWidgets = [ + if (showThreadTail) + Container( + margin: EdgeInsets.only( + bottom: context.textScaleFactor * + ((widget.messageTheme.repliesStyle?.fontSize ?? 1) / 2), + ), + child: CustomPaint( + size: const Size(16, 32) * context.textScaleFactor, + painter: _ThreadReplyPainter( + context: context, + color: widget.messageTheme.messageBorderColor, + reverse: widget.reverse, + ), + ), + ), + if (showInChannel || showThreadReplyIndicator) ...[ + if (showThreadParticipants) + SizedBox.fromSize( + size: Size((threadParticipants!.length * 8.0) + 8, 16), + child: _buildThreadParticipantsIndicator(threadParticipants), + ), + InkWell( + onTap: widget.onThreadTap != null ? onThreadTap : null, + child: Text(msg, style: widget.messageTheme.repliesStyle), + ), + ], + ]; + return Row( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: widget.reverse ? MainAxisAlignment.end : MainAxisAlignment.start, children: [ - if (showThreadTail && !widget.reverse) - Container( - margin: EdgeInsets.only( - bottom: context.textScaleFactor * - ((widget.messageTheme.repliesStyle?.fontSize ?? 1) / 2), - ), - child: CustomPaint( - size: const Size(16, 32) * context.textScaleFactor, - painter: _ThreadReplyPainter( - context: context, - color: widget.messageTheme.messageBorderColor, - reverse: widget.reverse, - ), - ), - ), + if (showThreadTail && !widget.reverse) ...threadIndicatorWidgets, ...children.map( (child) { Widget mappedChild = SizedBox( @@ -965,20 +969,7 @@ class _StreamMessageWidgetState extends State }, ), if (showThreadTail && widget.reverse) - Container( - margin: EdgeInsets.only( - bottom: context.textScaleFactor * - ((widget.messageTheme.repliesStyle?.fontSize ?? 1) / 2), - ), - child: CustomPaint( - size: const Size(16, 32) * context.textScaleFactor, - painter: _ThreadReplyPainter( - context: context, - color: widget.messageTheme.messageBorderColor, - reverse: widget.reverse, - ), - ), - ), + ...threadIndicatorWidgets.reversed, ].insertBetween(const SizedBox(width: 8)), ); } From 44972fdc3f7f66cfad0afa0246197d5d4294d179 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 4 May 2022 12:58:45 +0200 Subject: [PATCH 2/2] chore(ui): update changelog --- packages/stream_chat_flutter/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index dfa88d5f..5adf5c65 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -3,6 +3,7 @@ 🐞 Fixed - Fixed attachment picker ui. +- Fixed message widget thread indicator in reverse mode. ## 4.0.1