init: Start working on attachment
This commit is contained in:
@@ -31,65 +31,63 @@ class GiphyAttachment extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Card(
|
return Column(
|
||||||
child: Column(
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisSize: MainAxisSize.min,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Stack(
|
||||||
Stack(
|
children: <Widget>[
|
||||||
children: <Widget>[
|
GestureDetector(
|
||||||
GestureDetector(
|
onTap: () {
|
||||||
onTap: () {
|
Navigator.push(context, MaterialPageRoute(builder: (_) {
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (_) {
|
return FullScreenImage(
|
||||||
return FullScreenImage(
|
url: attachment.imageUrl ??
|
||||||
url: attachment.imageUrl ??
|
attachment.assetUrl ??
|
||||||
attachment.assetUrl ??
|
attachment.thumbUrl,
|
||||||
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: messageTheme.messageBackgroundColor,
|
|
||||||
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: messageTheme.messageBackgroundColor,
|
||||||
|
child: AttachmentTitle(
|
||||||
|
messageTheme: messageTheme,
|
||||||
|
attachment: attachment,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
if (attachment.actions != null)
|
||||||
|
AttachmentActions(
|
||||||
|
attachment: attachment,
|
||||||
|
message: message,
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ class MessageWidget extends StatefulWidget {
|
|||||||
'giphy': (context, message, attachment) {
|
'giphy': (context, message, attachment) {
|
||||||
return GiphyAttachment(
|
return GiphyAttachment(
|
||||||
attachment: attachment,
|
attachment: attachment,
|
||||||
messageTheme: messageTheme,
|
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,
|
||||||
|
|||||||
Reference in New Issue
Block a user