perf: only build reaction indicator when needed
This commit is contained in:
@@ -595,6 +595,8 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
final bottomRowPadding =
|
final bottomRowPadding =
|
||||||
widget.showUserAvatar != DisplayWidget.gone ? avatarWidth + 8.5 : 0.5;
|
widget.showUserAvatar != DisplayWidget.gone ? avatarWidth + 8.5 : 0.5;
|
||||||
|
|
||||||
|
final showReactions = _shouldShowReactions;
|
||||||
|
|
||||||
return Material(
|
return Material(
|
||||||
type: widget.message.pinned && widget.showPinHighlight
|
type: widget.message.pinned && widget.showPinHighlight
|
||||||
? MaterialType.card
|
? MaterialType.card
|
||||||
@@ -658,15 +660,21 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
SizedBox(width: avatarWidth + 4),
|
SizedBox(width: avatarWidth + 4),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: PortalEntry(
|
child: PortalEntry(
|
||||||
visible: _shouldShowReactions,
|
visible: showReactions,
|
||||||
portal: Container(
|
portal: showReactions
|
||||||
transform: Matrix4.translationValues(
|
? Container(
|
||||||
widget.reverse ? 12 : -12, 0, 0),
|
transform:
|
||||||
constraints: const BoxConstraints(
|
Matrix4.translationValues(
|
||||||
maxWidth: 22 * 6.0,
|
widget.reverse ? 12 : -12,
|
||||||
),
|
0,
|
||||||
child: _buildReactionIndicator(context),
|
0),
|
||||||
),
|
constraints: const BoxConstraints(
|
||||||
|
maxWidth: 22 * 6.0,
|
||||||
|
),
|
||||||
|
child: _buildReactionIndicator(
|
||||||
|
context),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
portalAnchor:
|
portalAnchor:
|
||||||
Alignment(widget.reverse ? 1 : -1, -1),
|
Alignment(widget.reverse ? 1 : -1, -1),
|
||||||
childAnchor:
|
childAnchor:
|
||||||
|
|||||||
Reference in New Issue
Block a user