Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Support album covers for file-based galleries

r4khul79bc031501f8
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/component/album_cover_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/gallery/component/album_cover_app_bar.dart
index 1e8560ef49..c57968176f 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/component/album_cover_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/component/album_cover_app_bar.dart
@@ -22,7 +22,7 @@ import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart
class AlbumCoverAppBar extends StatefulWidget {
const AlbumCoverAppBar({
super.key,
- required this.collection,
+ this.collection,
required this.cover,
required this.title,
required this.actionsBuilder,
@@ -33,7 +33,7 @@ class AlbumCoverAppBar extends StatefulWidget {
this.bottom,
});
- final Collection collection;
+ final Collection? collection;
final EnteFile cover;
final String title;
final List<Widget> Function(Color foregroundColor) actionsBuilder;
@@ -104,7 +104,7 @@ class _AlbumCoverAppBarState extends State<AlbumCoverAppBar> with RouteAware {
Widget build(BuildContext context) {
final colors = context.componentColors;
final bottomHeight = widget.bottom?.preferredSize.height ?? 0;
- final description = widget.collection.displayDescription;
+ final description = widget.collection?.displayDescription;
final geometry = AlbumCoverAppBar.resolveGeometry(
context,
collapsedHeight: widget.collapsedHeight,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index a686960e92..cd7c2e81b8 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -84,7 +84,7 @@ class GalleryAppBarWidget extends StatefulWidget {
PreferredSizeWidget? bottom,
bool showOverflowMenu = true,
}) {
- assert(cover == null || collection != null);
+ assert(cover == null || collection != null || files != null);
return GalleryAppBarConfig(
extendBodyForCollapse: cover != null && bottom == null,
sliverBuilder: (_) => GalleryAppBarWidget._(
@@ -367,7 +367,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
final strings = context.strings;
return AlbumCoverAppBar(
key: widget.coverAppBarKey,
- collection: widget.collection!,
+ collection: widget.collection,
cover: widget.cover!,
heroTag: widget.coverHeroTag,
title: _appBarTitle,
@@ -1200,7 +1200,10 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
await showAlbumSlideshow(
context,
files: galleryFiles,
- title: widget.deviceCollection?.name ?? widget.collection!.displayName,
+ title:
+ widget.deviceCollection?.name ??
+ widget.collection?.displayName ??
+ _appBarTitle,
includeBackupExcludedFiles: widget.deviceCollection != null,
);
}
diff --git a/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart b/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart
index 106d1525a6..72de4337a6 100644
--- a/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart
@@ -64,7 +64,7 @@ void main() {
]) {
tester.view.physicalSize = size;
final header = _coverHeader(cover);
- header.collection.pubMagicMetadata = CollectionPubMagicMetadata(
+ header.collection!.pubMagicMetadata = CollectionPubMagicMetadata(
description: caption,
);
await tester.pumpWidget(
@@ -157,7 +157,7 @@ void main() {
valueListenable: files,
builder: (_, files, _) {
final header = _coverHeader(cover);
- header.collection.pubMagicMetadata = CollectionPubMagicMetadata(
+ header.collection!.pubMagicMetadata = CollectionPubMagicMetadata(
description:
"An album description that wraps onto several lines.",
);