You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-06-19 04:07:43 +02:00
feat: manual stack assets (#4198)
This commit is contained in:
47
mobile/lib/modules/home/models/selection_state.dart
Normal file
47
mobile/lib/modules/home/models/selection_state.dart
Normal file
@ -0,0 +1,47 @@
|
||||
import 'package:immich_mobile/shared/models/asset.dart';
|
||||
|
||||
class SelectionAssetState {
|
||||
final bool hasRemote;
|
||||
final bool hasLocal;
|
||||
final bool hasMerged;
|
||||
|
||||
const SelectionAssetState({
|
||||
this.hasRemote = false,
|
||||
this.hasLocal = false,
|
||||
this.hasMerged = false,
|
||||
});
|
||||
|
||||
SelectionAssetState copyWith({
|
||||
bool? hasRemote,
|
||||
bool? hasLocal,
|
||||
bool? hasMerged,
|
||||
}) {
|
||||
return SelectionAssetState(
|
||||
hasRemote: hasRemote ?? this.hasRemote,
|
||||
hasLocal: hasLocal ?? this.hasLocal,
|
||||
hasMerged: hasMerged ?? this.hasMerged,
|
||||
);
|
||||
}
|
||||
|
||||
SelectionAssetState.fromSelection(Set<Asset> selection)
|
||||
: hasLocal = selection.any((e) => e.storage == AssetState.local),
|
||||
hasMerged = selection.any((e) => e.storage == AssetState.merged),
|
||||
hasRemote = selection.any((e) => e.storage == AssetState.remote);
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'SelectionAssetState(hasRemote: $hasRemote, hasMerged: $hasMerged, hasMerged: $hasMerged)';
|
||||
|
||||
@override
|
||||
bool operator ==(covariant SelectionAssetState other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other.hasRemote == hasRemote &&
|
||||
other.hasLocal == hasLocal &&
|
||||
other.hasMerged == hasMerged;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
hasRemote.hashCode ^ hasLocal.hashCode ^ hasMerged.hashCode;
|
||||
}
|
Reference in New Issue
Block a user