From 3c7b10173d80342dcba29535e973bfc79c649c94 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Fri, 20 Nov 2020 17:17:52 +0530 Subject: [PATCH] fix: Fixed icons, timing, copy button --- lib/src/full_screen_image.dart | 14 +++++++++++++- lib/src/image_actions_modal.dart | 1 - lib/src/image_footer.dart | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/src/full_screen_image.dart b/lib/src/full_screen_image.dart index a55cb187..52e75871 100644 --- a/lib/src/full_screen_image.dart +++ b/lib/src/full_screen_image.dart @@ -107,7 +107,7 @@ class _FullScreenImageState extends State ImageHeader( userName: widget.userName, sentAt: - 'Sent at${Jiffy(widget.sentAt.toLocal()).format(' HH:mm')}', + 'Sent ${getDay(widget.message.createdAt)} at ${Jiffy(widget.sentAt.toLocal()).format('HH:mm')}', onBackPressed: () { Navigator.of(context).pop(); }, @@ -128,4 +128,16 @@ class _FullScreenImageState extends State ), ); } + + String getDay(DateTime dateTime) { + var now = DateTime.now(); + + if(DateTime(dateTime.year, dateTime.month, dateTime.day) == DateTime(now.year, now.month, now.day)) { + return 'today'; + } else if(DateTime(now.year, now.month, now.day).difference(dateTime).inHours < 24) { + return 'yesterday'; + } else { + return 'on ${Jiffy(dateTime).format("MMM do")}'; + } + } } diff --git a/lib/src/image_actions_modal.dart b/lib/src/image_actions_modal.dart index f07efcb6..f46cb008 100644 --- a/lib/src/image_actions_modal.dart +++ b/lib/src/image_actions_modal.dart @@ -122,7 +122,6 @@ class ImageActionsModal extends StatelessWidget { urls[currentIndex].split('?')[0]); Navigator.pop(context); }), - _buildButton(context, 'Copy', StreamIcons.copy, () {}), if (StreamChat.of(context).user.id == message.user.id) _buildButton(context, 'Delete', StreamIcons.delete, () { diff --git a/lib/src/image_footer.dart b/lib/src/image_footer.dart index 57119f8e..b1cf65d3 100644 --- a/lib/src/image_footer.dart +++ b/lib/src/image_footer.dart @@ -86,7 +86,7 @@ class _ImageFooterState extends State { children: [ IconButton( icon: Icon( - StreamIcons.share, + StreamIcons.share_1, size: 24.0, color: Colors.black, ),