[mob][photos] Show video duration only on GalleryFileWidget and show a centered play icon otherwise
This commit is contained in:
@@ -26,6 +26,7 @@ import 'package:photos/utils/thumbnail_util.dart';
|
||||
class ThumbnailWidget extends StatefulWidget {
|
||||
final EnteFile file;
|
||||
final BoxFit fit;
|
||||
|
||||
final bool shouldShowSyncStatus;
|
||||
final bool shouldShowArchiveStatus;
|
||||
final bool shouldShowPinIcon;
|
||||
@@ -37,6 +38,10 @@ 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,
|
||||
@@ -51,6 +56,7 @@ class ThumbnailWidget extends StatefulWidget {
|
||||
this.serverLoadDeferDuration,
|
||||
this.thumbnailSize = thumbnailSmallSize,
|
||||
this.shouldShowFavoriteIcon = true,
|
||||
this.shouldShowVideoDuration = false,
|
||||
}) : super(key: key ?? Key(file.tag));
|
||||
|
||||
@override
|
||||
@@ -142,8 +148,12 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
@@ -55,6 +55,7 @@ class GalleryFileWidget extends StatelessWidget {
|
||||
? thumbnailLargeSize
|
||||
: thumbnailSmallSize,
|
||||
shouldShowOwnerAvatar: !isFileSelected,
|
||||
shouldShowVideoDuration: true,
|
||||
);
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
|
||||
@@ -74,7 +74,9 @@ class PersonFaceWidget extends StatelessWidget {
|
||||
log('Error getting cover face for person: ${snapshot.error}');
|
||||
}
|
||||
return thumbnailFallback
|
||||
? ThumbnailWidget(file)
|
||||
? ThumbnailWidget(
|
||||
file,
|
||||
)
|
||||
: const EnteLoadingWidget();
|
||||
}
|
||||
},
|
||||
@@ -96,7 +98,9 @@ class PersonFaceWidget extends StatelessWidget {
|
||||
log('Error getting cover face for person: ${snapshot.error}');
|
||||
}
|
||||
return thumbnailFallback
|
||||
? ThumbnailWidget(file)
|
||||
? ThumbnailWidget(
|
||||
file,
|
||||
)
|
||||
: const EnteLoadingWidget();
|
||||
}
|
||||
},
|
||||
@@ -188,7 +192,7 @@ class PersonFaceWidget extends StatelessWidget {
|
||||
stackTrace: s,
|
||||
);
|
||||
resetPool(fullFile: useFullFile);
|
||||
if(fetchAttempt <= retryLimit) {
|
||||
if (fetchAttempt <= retryLimit) {
|
||||
return getFaceCrop(fetchAttempt: fetchAttempt + 1);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user