From 660bae35832c5cf7d779c2046cf88e914f69366b Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 5 May 2021 12:36:13 +0200 Subject: [PATCH] fix messageinput overflow when no action is available --- .../lib/src/message_input.dart | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index aa14882e..57125e61 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -482,25 +482,29 @@ class MessageInputState extends State { ), splashRadius: 24, ), - secondChild: FittedBox( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - if (!widget.disableAttachments) _buildAttachmentButton(), - if (widget.showCommandsButton && - widget.editMessage == null && - StreamChannel.of(context) - .channel - .config - ?.commands - .isNotEmpty == - true) - _buildCommandButton(), - ...widget.actions ?? [], - ].insertBetween(const SizedBox(width: 8)), - ), - ), + secondChild: widget.disableAttachments && + !widget.showCommandsButton && + widget.actions?.isNotEmpty != true + ? Offstage() + : FittedBox( + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + if (!widget.disableAttachments) _buildAttachmentButton(), + if (widget.showCommandsButton && + widget.editMessage == null && + StreamChannel.of(context) + .channel + .config + ?.commands + .isNotEmpty == + true) + _buildCommandButton(), + ...widget.actions ?? [], + ].insertBetween(const SizedBox(width: 8)), + ), + ), duration: Duration(milliseconds: 300), alignment: Alignment.center, ),