change bg to white

This commit is contained in:
Deven Joshi
2020-11-02 15:50:19 +05:30
parent 950d852b0c
commit 5488fde66e
2 changed files with 54 additions and 57 deletions
+51 -54
View File
@@ -31,66 +31,63 @@ class GiphyAttachment extends StatelessWidget {
); );
} }
return Container( return Column(
color: Colors.white, mainAxisSize: MainAxisSize.min,
child: Column( crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min, children: <Widget>[
crossAxisAlignment: CrossAxisAlignment.stretch, Stack(
children: <Widget>[ children: <Widget>[
Stack( GestureDetector(
children: <Widget>[ onTap: () {
GestureDetector( Navigator.push(context, MaterialPageRoute(builder: (_) {
onTap: () { return FullScreenImage(
Navigator.push(context, MaterialPageRoute(builder: (_) { url: attachment.imageUrl ??
return FullScreenImage( attachment.assetUrl ??
url: attachment.imageUrl ?? attachment.thumbUrl,
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( imageUrl: attachment.thumbUrl ??
height: size?.height, attachment.imageUrl ??
width: size?.width, attachment.assetUrl,
placeholder: (_, __) { errorWidget: (context, url, error) => AttachmentError(
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,
attachment: attachment, attachment: attachment,
size: size,
), ),
fit: BoxFit.cover,
), ),
), ),
if (attachment.actions != null) ],
AttachmentActions( ),
attachment: attachment, if (attachment.title != null)
message: message, Container(
alignment: Alignment.bottomCenter,
child: Material(
color: Colors.white,
child: AttachmentTitle(
messageTheme: messageTheme,
attachment: attachment,
),
), ),
], ),
), if (attachment.actions != null)
AttachmentActions(
attachment: attachment,
message: message,
),
],
); );
} }
} }
+3 -3
View File
@@ -512,12 +512,12 @@ class _MessageWidgetState extends State<MessageWidget> {
widget.message, widget.message,
attachment, attachment,
); );
return wrapAttachmentWidget(context, attachmentWidget); return wrapAttachmentWidget(context, attachmentWidget, attachment: attachment);
})?.toList() ?? })?.toList() ??
[]; [];
} }
Padding wrapAttachmentWidget(BuildContext context, Widget attachmentWidget) { Padding wrapAttachmentWidget(BuildContext context, Widget attachmentWidget, {Attachment attachment}) {
return Padding( return Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: 4, bottom: 4,
@@ -526,7 +526,7 @@ class _MessageWidgetState extends State<MessageWidget> {
onTap: () => retryMessage(context), onTap: () => retryMessage(context),
onLongPress: () => onLongPress(context), onLongPress: () => onLongPress(context),
child: Material( child: Material(
color: _getBackgroundColor(), color: attachment?.type == 'giphy' ? Colors.white : _getBackgroundColor(),
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
shape: widget.attachmentShape ?? shape: widget.attachmentShape ??
widget.shape ?? widget.shape ??