diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index c4b03ce2..8f4b0158 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -272,6 +272,12 @@ class _MessageWidgetState extends State { widget.message.attachments?.any((element) => element.type == 'giphy') == true; + bool get hasNonUrlAttachments => + widget.message.attachments + ?.where((it) => it.ogScrapeUrl == null) + ?.isNotEmpty == + true; + bool get showBottomRow => showThreadReplyIndicator || showUsername || @@ -409,8 +415,9 @@ class _MessageWidgetState extends State { children: [ if (hasQuotedMessage) _buildQuotedMessage(), - ..._parseAttachments( - context), + if (hasNonUrlAttachments) + ..._parseAttachments( + context), if (widget.message.text .trim() .isNotEmpty && @@ -487,13 +494,21 @@ class _MessageWidgetState extends State { widget.onQuotedMessageTap != null ? () => widget.onQuotedMessageTap(widget.message.quotedMessageId) : null; - return QuotedMessageWidget( - onTap: onTap, - message: widget.message.quotedMessage, - messageTheme: isMyMessage - ? StreamChatTheme.of(context).otherMessageTheme - : StreamChatTheme.of(context).ownMessageTheme, - reverse: widget.reverse, + return Padding( + padding: EdgeInsets.only( + right: 8, + left: 8, + top: 8, + bottom: hasNonUrlAttachments ? 8 : 0, + ), + child: QuotedMessageWidget( + onTap: onTap, + message: widget.message.quotedMessage, + messageTheme: isMyMessage + ? StreamChatTheme.of(context).otherMessageTheme + : StreamChatTheme.of(context).ownMessageTheme, + reverse: widget.reverse, + ), ); } diff --git a/lib/src/quoted_message_widget.dart b/lib/src/quoted_message_widget.dart index c718cdb5..309df703 100644 --- a/lib/src/quoted_message_widget.dart +++ b/lib/src/quoted_message_widget.dart @@ -109,17 +109,14 @@ class QuotedMessageWidget extends StatelessWidget { Widget build(BuildContext context) { return InkWell( onTap: onTap, - child: Padding( - padding: const EdgeInsets.only(top: 8, right: 4, left: 8), - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - Flexible(child: _buildMessage(context)), - SizedBox(width: 4), - _buildUserAvatar(), - ], - ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + Flexible(child: _buildMessage(context)), + SizedBox(width: 8), + _buildUserAvatar(), + ], ), ); } @@ -247,16 +244,13 @@ class QuotedMessageWidget extends StatelessWidget { return Transform( transform: Matrix4.rotationY(reverse ? pi : 0), alignment: Alignment.center, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 4.0), - child: UserAvatar( - user: message.user, - constraints: BoxConstraints.tightFor( - height: 24, - width: 24, - ), - showOnlineStatus: false, + child: UserAvatar( + user: message.user, + constraints: BoxConstraints.tightFor( + height: 24, + width: 24, ), + showOnlineStatus: false, ), ); }