From 5488fde66e3f17b7c4fac8ecb840fc94a7756666 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Mon, 2 Nov 2020 15:50:19 +0530 Subject: [PATCH] change bg to white --- lib/src/giphy_attachment.dart | 105 +++++++++++++++++----------------- lib/src/message_widget.dart | 6 +- 2 files changed, 54 insertions(+), 57 deletions(-) diff --git a/lib/src/giphy_attachment.dart b/lib/src/giphy_attachment.dart index febc757e..6a5d44b8 100644 --- a/lib/src/giphy_attachment.dart +++ b/lib/src/giphy_attachment.dart @@ -31,66 +31,63 @@ class GiphyAttachment extends StatelessWidget { ); } - return Container( - color: Colors.white, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Stack( - children: [ - GestureDetector( - onTap: () { - Navigator.push(context, MaterialPageRoute(builder: (_) { - return FullScreenImage( - url: attachment.imageUrl ?? - attachment.assetUrl ?? - attachment.thumbUrl, - ); - })); + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Stack( + children: [ + GestureDetector( + onTap: () { + Navigator.push(context, MaterialPageRoute(builder: (_) { + return FullScreenImage( + url: attachment.imageUrl ?? + attachment.assetUrl ?? + attachment.thumbUrl, + ); + })); + }, + child: CachedNetworkImage( + height: size?.height, + width: size?.width, + placeholder: (_, __) { + return Container( + width: size?.width, + height: size?.height, + child: Center( + child: CircularProgressIndicator(), + ), + ); }, - child: CachedNetworkImage( - height: size?.height, - width: size?.width, - placeholder: (_, __) { - return Container( - width: size?.width, - height: size?.height, - child: Center( - child: CircularProgressIndicator(), - ), - ); - }, - imageUrl: attachment.thumbUrl ?? - attachment.imageUrl ?? - attachment.assetUrl, - errorWidget: (context, url, error) => AttachmentError( - attachment: attachment, - size: size, - ), - fit: BoxFit.cover, - ), - ), - ], - ), - if (attachment.title != null) - Container( - alignment: Alignment.bottomCenter, - child: Material( - color: Colors.white, - child: AttachmentTitle( - messageTheme: messageTheme, + imageUrl: attachment.thumbUrl ?? + attachment.imageUrl ?? + attachment.assetUrl, + errorWidget: (context, url, error) => AttachmentError( attachment: attachment, + size: size, ), + fit: BoxFit.cover, ), ), - if (attachment.actions != null) - AttachmentActions( - attachment: attachment, - message: message, + ], + ), + if (attachment.title != null) + Container( + alignment: Alignment.bottomCenter, + child: Material( + color: Colors.white, + child: AttachmentTitle( + messageTheme: messageTheme, + attachment: attachment, + ), ), - ], - ), + ), + if (attachment.actions != null) + AttachmentActions( + attachment: attachment, + message: message, + ), + ], ); } } diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index 021fd588..73ace68b 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -512,12 +512,12 @@ class _MessageWidgetState extends State { widget.message, attachment, ); - return wrapAttachmentWidget(context, attachmentWidget); + return wrapAttachmentWidget(context, attachmentWidget, attachment: attachment); })?.toList() ?? []; } - Padding wrapAttachmentWidget(BuildContext context, Widget attachmentWidget) { + Padding wrapAttachmentWidget(BuildContext context, Widget attachmentWidget, {Attachment attachment}) { return Padding( padding: EdgeInsets.only( bottom: 4, @@ -526,7 +526,7 @@ class _MessageWidgetState extends State { onTap: () => retryMessage(context), onLongPress: () => onLongPress(context), child: Material( - color: _getBackgroundColor(), + color: attachment?.type == 'giphy' ? Colors.white : _getBackgroundColor(), clipBehavior: Clip.hardEdge, shape: widget.attachmentShape ?? widget.shape ??