fix: Removed bubble for giphy
This commit is contained in:
@@ -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,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -175,7 +175,9 @@ class MessageWidget extends StatefulWidget {
|
|||||||
'giphy': (context, message, attachment) {
|
'giphy': (context, message, attachment) {
|
||||||
return GiphyAttachment(
|
return GiphyAttachment(
|
||||||
attachment: attachment,
|
attachment: attachment,
|
||||||
messageTheme: messageTheme.copyWith(messageBackgroundColor: Colors.white,),
|
messageTheme: messageTheme.copyWith(
|
||||||
|
messageBackgroundColor: Colors.white,
|
||||||
|
),
|
||||||
message: message,
|
message: message,
|
||||||
size: Size(
|
size: Size(
|
||||||
MediaQuery.of(context).size.width * 0.8,
|
MediaQuery.of(context).size.width * 0.8,
|
||||||
@@ -205,6 +207,10 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
var leftPadding = widget.showUserAvatar != DisplayWidget.gone
|
var leftPadding = widget.showUserAvatar != DisplayWidget.gone
|
||||||
? widget.messageTheme.avatarTheme.constraints.maxWidth + 16.0
|
? widget.messageTheme.avatarTheme.constraints.maxWidth + 16.0
|
||||||
: 6.0;
|
: 6.0;
|
||||||
|
|
||||||
|
bool isGiphy =
|
||||||
|
widget.message.attachments.any((element) => element.type == 'giphy');
|
||||||
|
|
||||||
return Portal(
|
return Portal(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: widget.padding ?? EdgeInsets.all(8),
|
padding: widget.padding ?? EdgeInsets.all(8),
|
||||||
@@ -275,8 +281,9 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
..._parseAttachments(context),
|
..._parseAttachments(context),
|
||||||
if (widget.message.text
|
if (widget.message.text
|
||||||
.trim()
|
.trim()
|
||||||
.isNotEmpty && widget.message.type != 'giphy')
|
.isNotEmpty &&
|
||||||
|
!isGiphy)
|
||||||
_buildTextBubble(context),
|
_buildTextBubble(context),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -512,12 +519,14 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
widget.message,
|
widget.message,
|
||||||
attachment,
|
attachment,
|
||||||
);
|
);
|
||||||
return wrapAttachmentWidget(context, attachmentWidget, attachment: attachment);
|
return wrapAttachmentWidget(context, attachmentWidget,
|
||||||
|
attachment: attachment);
|
||||||
})?.toList() ??
|
})?.toList() ??
|
||||||
[];
|
[];
|
||||||
}
|
}
|
||||||
|
|
||||||
Padding wrapAttachmentWidget(BuildContext context, Widget attachmentWidget, {Attachment attachment}) {
|
Padding wrapAttachmentWidget(BuildContext context, Widget attachmentWidget,
|
||||||
|
{Attachment attachment}) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
bottom: 4,
|
bottom: 4,
|
||||||
@@ -526,7 +535,9 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
onTap: () => retryMessage(context),
|
onTap: () => retryMessage(context),
|
||||||
onLongPress: () => onLongPress(context),
|
onLongPress: () => onLongPress(context),
|
||||||
child: Material(
|
child: Material(
|
||||||
color: attachment?.type == 'giphy' ? Colors.white : _getBackgroundColor(),
|
color: attachment?.type == 'giphy'
|
||||||
|
? Colors.white
|
||||||
|
: _getBackgroundColor(),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
shape: widget.attachmentShape ??
|
shape: widget.attachmentShape ??
|
||||||
widget.shape ??
|
widget.shape ??
|
||||||
|
|||||||
Reference in New Issue
Block a user