init: Start working on attachment

This commit is contained in:
Deven Joshi
2020-10-30 13:51:02 +05:30
parent a1f556ca2d
commit 95d466bb9b
+53 -51
View File
@@ -31,63 +31,65 @@ class GiphyAttachment extends StatelessWidget {
); );
} }
return Column( return Card(
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(),
),
);
}, },
imageUrl: attachment.thumbUrl ?? child: CachedNetworkImage(
attachment.imageUrl ?? height: size?.height,
attachment.assetUrl, width: size?.width,
errorWidget: (context, url, error) => AttachmentError( 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: messageTheme.messageBackgroundColor,
child: AttachmentTitle(
messageTheme: messageTheme,
attachment: attachment, attachment: attachment,
size: size,
), ),
fit: BoxFit.cover,
), ),
), ),
], if (attachment.actions != null)
), AttachmentActions(
if (attachment.title != null) attachment: attachment,
Container( message: message,
alignment: Alignment.bottomCenter,
child: Material(
color: messageTheme.messageBackgroundColor,
child: AttachmentTitle(
messageTheme: messageTheme,
attachment: attachment,
),
), ),
), ],
if (attachment.actions != null) ),
AttachmentActions(
attachment: attachment,
message: message,
),
],
); );
} }
} }