From 312e1722784a337539331ea42ad80f875082193f Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Wed, 4 Nov 2020 17:48:31 +0530 Subject: [PATCH] fix: Removed bubble for giphy --- lib/src/giphy_attachment.dart | 9 +-------- lib/src/message_widget.dart | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/src/giphy_attachment.dart b/lib/src/giphy_attachment.dart index 7bb76a84..1227572d 100644 --- a/lib/src/giphy_attachment.dart +++ b/lib/src/giphy_attachment.dart @@ -308,15 +308,8 @@ class GiphyAttachment extends StatelessWidget { ), ], ), - Text( - Jiffy(message.createdAt.toLocal()).format(' HH:mm'), - style: TextStyle( - fontSize: 12.0, - color: Colors.black.withOpacity(0.5), - ), - ) ], - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.start, ), ) ], diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index 84115d18..53be9ae6 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -175,7 +175,9 @@ class MessageWidget extends StatefulWidget { 'giphy': (context, message, attachment) { return GiphyAttachment( attachment: attachment, - messageTheme: messageTheme.copyWith(messageBackgroundColor: Colors.white,), + messageTheme: messageTheme.copyWith( + messageBackgroundColor: Colors.white, + ), message: message, size: Size( MediaQuery.of(context).size.width * 0.8, @@ -205,6 +207,10 @@ class _MessageWidgetState extends State { var leftPadding = widget.showUserAvatar != DisplayWidget.gone ? widget.messageTheme.avatarTheme.constraints.maxWidth + 16.0 : 6.0; + + bool isGiphy = + widget.message.attachments.any((element) => element.type == 'giphy'); + return Portal( child: Padding( padding: widget.padding ?? EdgeInsets.all(8), @@ -275,8 +281,9 @@ class _MessageWidgetState extends State { children: [ ..._parseAttachments(context), if (widget.message.text - .trim() - .isNotEmpty && widget.message.type != 'giphy') + .trim() + .isNotEmpty && + !isGiphy) _buildTextBubble(context), ], ), @@ -512,12 +519,14 @@ class _MessageWidgetState extends State { widget.message, attachment, ); - return wrapAttachmentWidget(context, attachmentWidget, attachment: attachment); + return wrapAttachmentWidget(context, attachmentWidget, + attachment: attachment); })?.toList() ?? []; } - Padding wrapAttachmentWidget(BuildContext context, Widget attachmentWidget, {Attachment attachment}) { + Padding wrapAttachmentWidget(BuildContext context, Widget attachmentWidget, + {Attachment attachment}) { return Padding( padding: EdgeInsets.only( bottom: 4, @@ -526,7 +535,9 @@ class _MessageWidgetState extends State { onTap: () => retryMessage(context), onLongPress: () => onLongPress(context), child: Material( - color: attachment?.type == 'giphy' ? Colors.white : _getBackgroundColor(), + color: attachment?.type == 'giphy' + ? Colors.white + : _getBackgroundColor(), clipBehavior: Clip.hardEdge, shape: widget.attachmentShape ?? widget.shape ??