fix: Removed bubble for giphy

This commit is contained in:
Deven Joshi
2020-11-04 17:48:31 +05:30
parent 756e8d6555
commit 312e172278
2 changed files with 18 additions and 14 deletions
+1 -8
View File
@@ -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,
),
)
],
+17 -6
View File
@@ -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<MessageWidget> {
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<MessageWidget> {
children: <Widget>[
..._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<MessageWidget> {
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<MessageWidget> {
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 ??