fix: Added visibility message

This commit is contained in:
Deven Joshi
2020-11-04 16:54:58 +05:30
parent 3575089bf3
commit 9c3fc656e2
+198 -167
View File
@@ -41,190 +41,221 @@ class GiphyAttachment extends StatelessWidget {
Widget _buildSendingAttachment(context) { Widget _buildSendingAttachment(context) {
final streamChannel = StreamChannel.of(context); final streamChannel = StreamChannel.of(context);
return Card( return Column(
clipBehavior: Clip.antiAlias, mainAxisSize: MainAxisSize.min,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)), children: [
child: Column( Card(
mainAxisSize: MainAxisSize.min, clipBehavior: Clip.antiAlias,
crossAxisAlignment: CrossAxisAlignment.stretch, shape:
children: <Widget>[ RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
Stack( child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
GestureDetector( Stack(
onTap: () { children: <Widget>[
Navigator.push(context, MaterialPageRoute(builder: (_) { GestureDetector(
return FullScreenImage( onTap: () {
url: attachment.imageUrl ?? Navigator.push(context, MaterialPageRoute(builder: (_) {
attachment.assetUrl ?? return FullScreenImage(
attachment.thumbUrl, url: attachment.imageUrl ??
); attachment.assetUrl ??
})); attachment.thumbUrl,
}, );
child: Padding( }));
padding: const EdgeInsets.all(8.0),
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: Padding(
attachment.imageUrl ?? padding: const EdgeInsets.all(8.0),
attachment.assetUrl, child: CachedNetworkImage(
errorWidget: (context, url, error) => AttachmentError( height: size?.height,
attachment: attachment, width: size?.width,
size: size, placeholder: (_, __) {
), return Container(
fit: BoxFit.cover, width: size?.width,
), height: size?.height,
), child: Center(
), child: CircularProgressIndicator(),
Positioned( ),
left: 0, );
top: 0, },
child: Container( imageUrl: attachment.thumbUrl ??
decoration: BoxDecoration( attachment.imageUrl ??
color: Colors.white, attachment.assetUrl,
borderRadius: BorderRadius.only( errorWidget: (context, url, error) => AttachmentError(
bottomRight: Radius.circular(16.0), attachment: attachment,
)), size: size,
child: Padding(
padding: const EdgeInsets.only(
left: 4.0, right: 4.0, top: 6.0, bottom: 2.0),
child: Row(
children: [
Icon(
StreamIcons.lightning,
color: StreamChatTheme.of(context).accentColor,
size: 16.0,
), ),
Text( fit: BoxFit.cover,
'GIPHY', ),
style: TextStyle( ),
color: StreamChatTheme.of(context).accentColor, ),
fontWeight: FontWeight.bold, Positioned(
fontSize: 11.0, left: 0,
top: 0,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(16.0),
)),
child: Padding(
padding: const EdgeInsets.only(
left: 4.0, right: 4.0, top: 6.0, bottom: 2.0),
child: Row(
children: [
Icon(
StreamIcons.lightning,
color: StreamChatTheme.of(context).accentColor,
size: 16.0,
),
Text(
'GIPHY',
style: TextStyle(
color: StreamChatTheme.of(context).accentColor,
fontWeight: FontWeight.bold,
fontSize: 11.0,
),
),
],
),
),
),
),
],
),
if (attachment.title != null)
Container(
alignment: Alignment.bottomCenter,
child: Material(
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Card(
child: IconButton(
icon: Icon(
StreamIcons.left,
size: 24.0,
),
onPressed: () {
streamChannel.channel.sendAction(message, {
'image_action': 'shuffle',
});
},
), ),
shape: CircleBorder(),
),
Expanded(
child: Center(
child: Text(
'"${attachment.title}"',
style: TextStyle(
fontStyle: FontStyle.italic,
),
),
),
),
Card(
child: IconButton(
icon: Icon(
StreamIcons.right,
size: 24.0,
),
onPressed: () {
streamChannel.channel.sendAction(message, {
'image_action': 'shuffle',
});
},
),
shape: CircleBorder(),
), ),
], ],
), ),
), ),
), ),
), SizedBox(
], height: 4.0,
),
if (attachment.title != null)
Container(
alignment: Alignment.bottomCenter,
child: Material(
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Card(
child: IconButton(
icon: Icon(
StreamIcons.left,
size: 24.0,
),
onPressed: () {
streamChannel.channel.sendAction(message, {
'image_action': 'shuffle',
});
},
),
shape: CircleBorder(),
),
Expanded(
child: Center(
child: Text(
'"${attachment.title}"',
style: TextStyle(
fontStyle: FontStyle.italic,
),
),
),
),
Card(
child: IconButton(
icon: Icon(
StreamIcons.right,
size: 24.0,
),
onPressed: () {
streamChannel.channel.sendAction(message, {
'image_action': 'shuffle',
});
},
),
shape: CircleBorder(),
),
],
),
),
),
SizedBox(
height: 4.0,
),
Container(
color: Colors.black.withOpacity(0.2),
width: double.infinity,
height: 0.5,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
FlatButton(
onPressed: () {
streamChannel.channel.sendAction(message, {
'image_action': 'cancel',
});
},
child: Row(
children: [
Text(
'Cancel',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black.withOpacity(0.5)
),
),
],
),
), ),
Container( Container(
width: 0.5,
color: Colors.black.withOpacity(0.2), color: Colors.black.withOpacity(0.2),
height: 50.0, width: double.infinity,
height: 0.5,
), ),
FlatButton( Row(
onPressed: () { mainAxisAlignment: MainAxisAlignment.spaceEvenly,
streamChannel.channel.sendAction(message, { crossAxisAlignment: CrossAxisAlignment.start,
'image_action': 'send', children: [
}); FlatButton(
}, onPressed: () {
child: Row( streamChannel.channel.sendAction(message, {
children: [ 'image_action': 'cancel',
Text( });
'Send', },
style: TextStyle( child: Row(
color: StreamChatTheme.of(context).accentColor, children: [
fontWeight: FontWeight.bold), Text(
'Cancel',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black.withOpacity(0.5)),
),
],
), ),
], ),
), Container(
width: 0.5,
color: Colors.black.withOpacity(0.2),
height: 50.0,
),
FlatButton(
onPressed: () {
streamChannel.channel.sendAction(message, {
'image_action': 'send',
});
},
child: Row(
children: [
Text(
'Send',
style: TextStyle(
color: StreamChatTheme.of(context).accentColor,
fontWeight: FontWeight.bold),
),
],
),
),
],
), ),
], ],
), ),
], ),
), SizedBox(
height: 4.0,
),
Align(
alignment: Alignment.centerRight,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
StreamIcons.eye,
color: Colors.black.withOpacity(0.5),
size: 16.0,
),
SizedBox(
width: 4.0,
),
Text(
'Only visible to you',
style: TextStyle(color: Colors.black.withOpacity(0.5)),
),
],
),
),
),
],
); );
} }