fix: show portal conditionally

This commit is contained in:
Gordon Hayes
2021-09-08 14:22:04 +02:00
parent 9b1d94693a
commit 0425d67747
@@ -658,7 +658,7 @@ class _MessageWidgetState extends State<MessageWidget>
SizedBox(width: avatarWidth + 4), SizedBox(width: avatarWidth + 4),
Flexible( Flexible(
child: PortalEntry( child: PortalEntry(
visible: false, visible: _shouldShowReactions,
portal: Container( portal: Container(
transform: Matrix4.translationValues( transform: Matrix4.translationValues(
widget.reverse ? 12 : -12, 0, 0), widget.reverse ? 12 : -12, 0, 0),
@@ -1014,9 +1014,7 @@ class _MessageWidgetState extends State<MessageWidget>
return AnimatedSwitcher( return AnimatedSwitcher(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
child: (widget.showReactions && child: _shouldShowReactions
(widget.message.reactionCounts?.isNotEmpty == true) &&
!widget.message.isDeleted)
? GestureDetector( ? GestureDetector(
onTap: () => _showMessageReactionsModalBottomSheet(context), onTap: () => _showMessageReactionsModalBottomSheet(context),
child: ReactionBubble( child: ReactionBubble(
@@ -1036,6 +1034,11 @@ class _MessageWidgetState extends State<MessageWidget>
); );
} }
bool get _shouldShowReactions =>
widget.showReactions &&
(widget.message.reactionCounts?.isNotEmpty == true) &&
!widget.message.isDeleted;
void _showMessageActionModalBottomSheet(BuildContext context) { void _showMessageActionModalBottomSheet(BuildContext context) {
final channel = StreamChannel.of(context).channel; final channel = StreamChannel.of(context).channel;