Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] fix: use selected albums for showing selected/unselected state

Aman Raj Singh Mouryaa8e80717aaef
diff --git a/mobile/lib/ui/collections/album/list_item.dart b/mobile/lib/ui/collections/album/list_item.dart
index 33ce31022c..79f6e92f81 100644
--- a/mobile/lib/ui/collections/album/list_item.dart
+++ b/mobile/lib/ui/collections/album/list_item.dart
@@ -4,6 +4,7 @@ import "package:logging/logging.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/collection/collection.dart";
import "package:photos/models/file/file.dart";
+import "package:photos/models/selected_albums.dart";
import "package:photos/services/collections_service.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/components/buttons/icon_button_widget.dart";
@@ -12,24 +13,24 @@ import "package:photos/ui/viewer/file/thumbnail_widget.dart";
class AlbumListItemWidget extends StatelessWidget {
final Collection collection;
-
- final List<Collection> selectedAlbums;
final void Function(Collection)? onTapCallback;
final void Function(Collection)? onLongPressCallback;
+ final SelectedAlbums? selectedAlbums;
const AlbumListItemWidget(
this.collection, {
super.key,
- this.selectedAlbums = const [],
this.onTapCallback,
this.onLongPressCallback,
+ this.selectedAlbums,
});
@override
Widget build(BuildContext context) {
final textTheme = getEnteTextTheme(context);
final colorScheme = getEnteColorScheme(context);
- final bool isSelected = selectedAlbums.contains(collection);
+ final bool isSelected =
+ selectedAlbums?.isAlbumSelected(collection) ?? false;
const sideOfThumbnail = 60.0;
return GestureDetector(
diff --git a/mobile/lib/ui/collections/album/row_item.dart b/mobile/lib/ui/collections/album/row_item.dart
index 41f6e26368..67c8c7cc56 100644
--- a/mobile/lib/ui/collections/album/row_item.dart
+++ b/mobile/lib/ui/collections/album/row_item.dart
@@ -4,6 +4,7 @@ import "package:photos/core/configuration.dart";
import 'package:photos/models/collection/collection.dart';
import 'package:photos/models/collection/collection_items.dart';
import 'package:photos/models/file/file.dart';
+import "package:photos/models/selected_albums.dart";
import "package:photos/services/collections_service.dart";
import "package:photos/theme/colors.dart";
import 'package:photos/theme/ente_theme.dart';
@@ -21,9 +22,9 @@ class AlbumRowItemWidget extends StatelessWidget {
final bool showFileCount;
final String tag;
final bool? hasVerifiedLock;
- final List<Collection> selectedAlbums;
final void Function(Collection)? onTapCallback;
final void Function(Collection)? onLongPressCallback;
+ final SelectedAlbums? selectedAlbum;
const AlbumRowItemWidget(
this.c,
@@ -32,15 +33,15 @@ class AlbumRowItemWidget extends StatelessWidget {
this.showFileCount = true,
this.tag = "",
this.hasVerifiedLock,
- this.selectedAlbums = const [],
this.onTapCallback,
this.onLongPressCallback,
+ this.selectedAlbum,
});
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
- final bool isSelected = selectedAlbums.contains(c);
+ final bool isSelected = selectedAlbum?.isAlbumSelected(c) ?? false;
final bool isOwner = c.isOwner(Configuration.instance.getUserID()!);
final String tagPrefix = (isOwner ? "collection" : "shared_collection") +
tag +