This commit is contained in:
Deven Joshi
2020-11-23 16:44:44 +05:30
parent 6424a0c9e5
commit d9507214d7
5 changed files with 135 additions and 116 deletions
+6 -2
View File
@@ -132,9 +132,13 @@ class _FullScreenImageState extends State<FullScreenImage>
String getDay(DateTime dateTime) { String getDay(DateTime dateTime) {
var now = DateTime.now(); var now = DateTime.now();
if(DateTime(dateTime.year, dateTime.month, dateTime.day) == DateTime(now.year, now.month, now.day)) { if (DateTime(dateTime.year, dateTime.month, dateTime.day) ==
DateTime(now.year, now.month, now.day)) {
return 'today'; return 'today';
} else if(DateTime(now.year, now.month, now.day).difference(dateTime).inHours < 24) { } else if (DateTime(now.year, now.month, now.day)
.difference(dateTime)
.inHours <
24) {
return 'yesterday'; return 'yesterday';
} else { } else {
return 'on ${Jiffy(dateTime).format("MMM do")}'; return 'on ${Jiffy(dateTime).format("MMM do")}';
+8 -4
View File
@@ -64,9 +64,11 @@ class GiphyAttachment extends StatelessWidget {
onTap: () { onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (_) { Navigator.push(context, MaterialPageRoute(builder: (_) {
return FullScreenImage( return FullScreenImage(
urls: [attachment.imageUrl ?? urls: [
attachment.imageUrl ??
attachment.assetUrl ?? attachment.assetUrl ??
attachment.thumbUrl], attachment.thumbUrl
],
userName: message.user.name, userName: message.user.name,
sentAt: message.createdAt, sentAt: message.createdAt,
message: message, message: message,
@@ -285,9 +287,11 @@ class GiphyAttachment extends StatelessWidget {
onTap: () { onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (_) { Navigator.push(context, MaterialPageRoute(builder: (_) {
return FullScreenImage( return FullScreenImage(
urls: [attachment.imageUrl ?? urls: [
attachment.imageUrl ??
attachment.assetUrl ?? attachment.assetUrl ??
attachment.thumbUrl], attachment.thumbUrl
],
userName: message.user.name, userName: message.user.name,
sentAt: message.createdAt, sentAt: message.createdAt,
message: message, message: message,
+4 -2
View File
@@ -48,9 +48,11 @@ class ImageAttachment extends StatelessWidget {
return StreamChannel( return StreamChannel(
channel: channel, channel: channel,
child: FullScreenImage( child: FullScreenImage(
urls: [attachment.imageUrl ?? urls: [
attachment.imageUrl ??
attachment.assetUrl ?? attachment.assetUrl ??
attachment.thumbUrl], attachment.thumbUrl
],
userName: message.user.name, userName: message.user.name,
sentAt: message.createdAt, sentAt: message.createdAt,
message: message, message: message,
+13 -6
View File
@@ -378,8 +378,9 @@ class _ImageFooterState extends State<ImageFooter> {
child: Material( child: Material(
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
await GallerySaver.saveImage( await GallerySaver.saveImage(widget
widget.urls[widget.currentPage].split('?')[0]); .urls[widget.currentPage]
.split('?')[0]);
Navigator.pop(context); Navigator.pop(context);
}, },
child: SizedBox.expand( child: SizedBox.expand(
@@ -434,7 +435,8 @@ class _ImageFooterState extends State<ImageFooter> {
autofocus: true, autofocus: true,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
prefixIconConstraints: BoxConstraints.tight(Size(38.0, 38.0)), prefixIconConstraints:
BoxConstraints.tight(Size(38.0, 38.0)),
prefixIcon: Transform.scale( prefixIcon: Transform.scale(
scale: 1.2, scale: 1.2,
alignment: Alignment.center, alignment: Alignment.center,
@@ -462,7 +464,10 @@ class _ImageFooterState extends State<ImageFooter> {
width: 8.0, width: 8.0,
), ),
IconButton( IconButton(
icon: Icon(StreamIcons.close_circle, color: Colors.black.withOpacity(0.5),), icon: Icon(
StreamIcons.close_circle,
color: Colors.black.withOpacity(0.5),
),
onPressed: () { onPressed: () {
modalSetState(() { modalSetState(() {
_userSearchMode = false; _userSearchMode = false;
@@ -533,12 +538,14 @@ class _ImageFooterState extends State<ImageFooter> {
child: Container( child: Container(
color: Colors.white, color: Colors.white,
height: 56.0, height: 56.0,
child: _loading ? Center( child: _loading
? Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
), ),
) : Row( )
: Row(
children: [ children: [
Expanded( Expanded(
child: Padding( child: Padding(
+5 -3
View File
@@ -113,10 +113,12 @@ class ImageGroup extends StatelessWidget {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => StreamChannel(
StreamChannel(
channel: channel, channel: channel,
child: FullScreenImage(urls: images.map((e) => e.imageUrl ?? e.thumbUrl ?? e.assetUrl).toList(), child: FullScreenImage(
urls: images
.map((e) => e.imageUrl ?? e.thumbUrl ?? e.assetUrl)
.toList(),
startIndex: index, startIndex: index,
userName: message.user.name, userName: message.user.name,
sentAt: message.createdAt, sentAt: message.createdAt,