@ -11,17 +11,16 @@ import 'package:immich_mobile/routing/router.dart';
import ' package:immich_mobile/shared/ui/immich_toast.dart ' ;
import ' package:immich_mobile/shared/ui/immich_toast.dart ' ;
class AlbumInfoCard extends HookConsumerWidget {
class AlbumInfoCard extends HookConsumerWidget {
final Uint8List ? imageData ;
final AvailableAlbum album ;
final AvailableAlbum albumInfo ;
const AlbumInfoCard ( { super . key , this . imageData , required this . album Info } ) ;
const AlbumInfoCard ( { super . key , required this . album } ) ;
@ override
@ override
Widget build ( BuildContext context , WidgetRef ref ) {
Widget build ( BuildContext context , WidgetRef ref ) {
final bool isSelected =
final bool isSelected =
ref . watch ( backupProvider ) . selectedBackupAlbums . contains ( album Info ) ;
ref . watch ( backupProvider ) . selectedBackupAlbums . contains ( album ) ;
final bool isExcluded =
final bool isExcluded =
ref . watch ( backupProvider ) . excludedBackupAlbums . contains ( album Info ) ;
ref . watch ( backupProvider ) . excludedBackupAlbums . contains ( album ) ;
final isDarkTheme = context . isDarkTheme ;
final isDarkTheme = context . isDarkTheme ;
ColorFilter selectedFilter = ColorFilter . mode (
ColorFilter selectedFilter = ColorFilter . mode (
@ -82,9 +81,9 @@ class AlbumInfoCard extends HookConsumerWidget {
HapticFeedback . selectionClick ( ) ;
HapticFeedback . selectionClick ( ) ;
if ( isSelected ) {
if ( isSelected ) {
ref . read ( backupProvider . notifier ) . removeAlbumForBackup ( album Info ) ;
ref . read ( backupProvider . notifier ) . removeAlbumForBackup ( album ) ;
} else {
} else {
ref . read ( backupProvider . notifier ) . addAlbumForBackup ( album Info ) ;
ref . read ( backupProvider . notifier ) . addAlbumForBackup ( album ) ;
}
}
} ,
} ,
onDoubleTap: ( ) {
onDoubleTap: ( ) {
@ -92,13 +91,11 @@ class AlbumInfoCard extends HookConsumerWidget {
if ( isExcluded ) {
if ( isExcluded ) {
/ / Remove from exclude album list
/ / Remove from exclude album list
ref
ref . read ( backupProvider . notifier ) . removeExcludedAlbumForBackup ( album ) ;
. read ( backupProvider . notifier )
. removeExcludedAlbumForBackup ( albumInfo ) ;
} else {
} else {
/ / Add to exclude album list
/ / Add to exclude album list
if ( album Info . id = = ' isAll ' | | album Info . name = = ' Recents ' ) {
if ( album . id = = ' isAll ' | | album . name = = ' Recents ' ) {
ImmichToast . show (
ImmichToast . show (
context: context ,
context: context ,
msg: ' Cannot exclude album contains all assets ' ,
msg: ' Cannot exclude album contains all assets ' ,
@ -108,9 +105,7 @@ class AlbumInfoCard extends HookConsumerWidget {
return ;
return ;
}
}
ref
ref . read ( backupProvider . notifier ) . addExcludedAlbumForBackup ( album ) ;
. read ( backupProvider . notifier )
. addExcludedAlbumForBackup ( albumInfo ) ;
}
}
} ,
} ,
child: Card (
child: Card (
@ -136,14 +131,12 @@ class AlbumInfoCard extends HookConsumerWidget {
children: [
children: [
ColorFiltered (
ColorFiltered (
colorFilter: buildImageFilter ( ) ,
colorFilter: buildImageFilter ( ) ,
child: Image (
child: const Image (
width: double . infinity ,
width: double . infinity ,
height: double . infinity ,
height: double . infinity ,
image: imageData ! = null
image: AssetImage (
? MemoryImage ( imageData ! )
' assets/immich-logo.png ' ,
: const AssetImage (
) ,
' assets/immich-logo.png ' ,
) as ImageProvider ,
fit: BoxFit . cover ,
fit: BoxFit . cover ,
) ,
) ,
) ,
) ,
@ -168,7 +161,7 @@ class AlbumInfoCard extends HookConsumerWidget {
mainAxisAlignment: MainAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . center ,
children: [
children: [
Text (
Text (
album Info . name ,
album . name ,
style: TextStyle (
style: TextStyle (
fontSize: 14 ,
fontSize: 14 ,
color: context . primaryColor ,
color: context . primaryColor ,
@ -182,7 +175,7 @@ class AlbumInfoCard extends HookConsumerWidget {
if ( snapshot . hasData ) {
if ( snapshot . hasData ) {
return Text (
return Text (
snapshot . data . toString ( ) +
snapshot . data . toString ( ) +
( album Info . isAll
( album . isAll
? " ( ${ ' backup_all ' . tr ( ) } ) "
? " ( ${ ' backup_all ' . tr ( ) } ) "
: " " ) ,
: " " ) ,
style: TextStyle (
style: TextStyle (
@ -193,7 +186,7 @@ class AlbumInfoCard extends HookConsumerWidget {
}
}
return const Text ( " 0 " ) ;
return const Text ( " 0 " ) ;
} ) ,
} ) ,
future: album Info . assetCount ,
future: album . assetCount ,
) ,
) ,
) ,
) ,
] ,
] ,
@ -202,7 +195,7 @@ class AlbumInfoCard extends HookConsumerWidget {
IconButton (
IconButton (
onPressed: ( ) {
onPressed: ( ) {
context . pushRoute (
context . pushRoute (
AlbumPreviewRoute ( album: album Info . albumEntity ) ,
AlbumPreviewRoute ( album: album . albumEntity ) ,
) ;
) ;
} ,
} ,
icon: Icon (
icon: Icon (