Merge pull request #1118 from GetStream/hotfix/messageWidget

fix(ui): fix message widget thread indicator in reverse mode
This commit is contained in:
Salvatore Giordano
2022-05-05 08:42:15 +02:00
committed by GitHub
2 changed files with 32 additions and 40 deletions
@@ -3,6 +3,7 @@
🐞 Fixed
- Fixed attachment picker ui.
- Fixed message widget thread indicator in reverse mode.
## 4.0.1
@@ -909,17 +909,6 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
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<StreamMessageWidget>
final showThreadTail = !(hasUrlAttachments || isGiphy || isOnlyEmoji) &&
(showThreadReplyIndicator || showInChannel);
final threadIndicatorWidgets = <Widget>[
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<StreamMessageWidget>
},
),
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)),
);
}