diff --git a/mobile/lib/ui/viewer/file/thumbnail_widget.dart b/mobile/lib/ui/viewer/file/thumbnail_widget.dart index 27a20e95ca..e380058304 100644 --- a/mobile/lib/ui/viewer/file/thumbnail_widget.dart +++ b/mobile/lib/ui/viewer/file/thumbnail_widget.dart @@ -26,6 +26,9 @@ import 'package:photos/utils/thumbnail_util.dart'; class ThumbnailWidget extends StatefulWidget { final EnteFile file; final BoxFit fit; + + /// Returns ThumbnailWidget without any overlay icons if true. + final bool rawThumbnail; final bool shouldShowSyncStatus; final bool shouldShowArchiveStatus; final bool shouldShowPinIcon; @@ -37,10 +40,15 @@ class ThumbnailWidget extends StatefulWidget { final bool shouldShowOwnerAvatar; final bool shouldShowFavoriteIcon; + ///On video thumbnails, shows the video duration if true. If false, + ///shows a centered play icon. + final bool shouldShowVideoDuration; + ThumbnailWidget( this.file, { Key? key, this.fit = BoxFit.cover, + this.rawThumbnail = false, this.shouldShowSyncStatus = true, this.shouldShowLivePhotoOverlay = false, this.shouldShowArchiveStatus = false, @@ -51,6 +59,7 @@ class ThumbnailWidget extends StatefulWidget { this.serverLoadDeferDuration, this.thumbnailSize = thumbnailSmallSize, this.shouldShowFavoriteIcon = true, + this.shouldShowVideoDuration = false, }) : super(key: key ?? Key(file.tag)); @override @@ -131,6 +140,9 @@ class _ThumbnailWidgetState extends State { // If yes, parent thumbnail widget can be stateless Widget? content; if (image != null) { + if (widget.rawThumbnail) { + return image; + } final List contentChildren = [image]; if (widget.shouldShowFavoriteIcon) { if (FavoritesService.instance.isFavoriteCache( @@ -142,8 +154,12 @@ class _ThumbnailWidgetState extends State { } if (widget.file.fileType == FileType.video) { - contentChildren - .add(VideoOverlayDuration(duration: widget.file.duration!)); + if (widget.shouldShowVideoDuration) { + contentChildren + .add(VideoOverlayDuration(duration: widget.file.duration!)); + } else { + contentChildren.add(const VideoOverlayIcon()); + } } else if (widget.shouldShowLivePhotoOverlay && widget.file.isLiveOrMotionPhoto) { contentChildren.add(const LivePhotoOverlayIcon()); diff --git a/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart b/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart index 5f1ce7cbfa..6bd6725376 100644 --- a/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart +++ b/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart @@ -55,6 +55,7 @@ class GalleryFileWidget extends StatelessWidget { ? thumbnailLargeSize : thumbnailSmallSize, shouldShowOwnerAvatar: !isFileSelected, + shouldShowVideoDuration: true, ); return GestureDetector( onTap: () { diff --git a/mobile/lib/ui/viewer/people/cropped_face_image_view.dart b/mobile/lib/ui/viewer/people/cropped_face_image_view.dart index a76dbe5f0a..1b8076ff23 100644 --- a/mobile/lib/ui/viewer/people/cropped_face_image_view.dart +++ b/mobile/lib/ui/viewer/people/cropped_face_image_view.dart @@ -96,6 +96,7 @@ class CroppedFaceImageView extends StatelessWidget { } return ThumbnailWidget( enteFile, + rawThumbnail: true, ); } }, diff --git a/mobile/lib/ui/viewer/search/result/person_face_widget.dart b/mobile/lib/ui/viewer/search/result/person_face_widget.dart index 57fe5af654..c7f427bf7c 100644 --- a/mobile/lib/ui/viewer/search/result/person_face_widget.dart +++ b/mobile/lib/ui/viewer/search/result/person_face_widget.dart @@ -74,7 +74,10 @@ class PersonFaceWidget extends StatelessWidget { log('Error getting cover face for person: ${snapshot.error}'); } return thumbnailFallback - ? ThumbnailWidget(file) + ? ThumbnailWidget( + file, + rawThumbnail: true, + ) : const EnteLoadingWidget(); } }, @@ -96,7 +99,10 @@ class PersonFaceWidget extends StatelessWidget { log('Error getting cover face for person: ${snapshot.error}'); } return thumbnailFallback - ? ThumbnailWidget(file) + ? ThumbnailWidget( + file, + rawThumbnail: true, + ) : const EnteLoadingWidget(); } }, @@ -188,7 +194,7 @@ class PersonFaceWidget extends StatelessWidget { stackTrace: s, ); resetPool(fullFile: useFullFile); - if(fetchAttempt <= retryLimit) { + if (fetchAttempt <= retryLimit) { return getFaceCrop(fetchAttempt: fetchAttempt + 1); } return null;