refactor(ui): refactor thread indicators

This commit is contained in:
Salvatore Giordano
2022-05-10 15:52:15 +02:00
parent 6975be45f3
commit d79ce76d13
@@ -926,7 +926,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
final showThreadTail = !(hasUrlAttachments || isGiphy || isOnlyEmoji) && final showThreadTail = !(hasUrlAttachments || isGiphy || isOnlyEmoji) &&
(showThreadReplyIndicator || showInChannel); (showThreadReplyIndicator || showInChannel);
final threadIndicatorWidgets = <InlineSpan>[ final threadIndicatorWidgets = <WidgetSpan>[
if (showThreadTail) if (showThreadTail)
WidgetSpan( WidgetSpan(
child: Container( child: Container(
@@ -961,12 +961,16 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
], ],
]; ];
if (widget.reverse) {
children.addAll(threadIndicatorWidgets.reversed);
} else {
children.insertAll(0, threadIndicatorWidgets);
}
return Text.rich( return Text.rich(
TextSpan( TextSpan(
children: [ children: [
if (!widget.reverse) ...threadIndicatorWidgets,
...children, ...children,
if (widget.reverse) ...threadIndicatorWidgets.reversed,
].insertBetween(const WidgetSpan(child: SizedBox(width: 8))), ].insertBetween(const WidgetSpan(child: SizedBox(width: 8))),
), ),
maxLines: 1, maxLines: 1,