mirror of
https://github.com/immich-app/immich.git
synced 2025-07-31 15:08:44 -04:00
* feat(mobile): drift search page * migrate to drift page --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
39 lines
925 B
Dart
39 lines
925 B
Dart
import 'package:collection/collection.dart';
|
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
|
|
|
class SearchResult {
|
|
final List<BaseAsset> assets;
|
|
final int? nextPage;
|
|
|
|
const SearchResult({
|
|
required this.assets,
|
|
this.nextPage,
|
|
});
|
|
|
|
int get totalAssets => assets.length;
|
|
|
|
SearchResult copyWith({
|
|
List<BaseAsset>? assets,
|
|
int? nextPage,
|
|
}) {
|
|
return SearchResult(
|
|
assets: assets ?? this.assets,
|
|
nextPage: nextPage ?? this.nextPage,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() => 'SearchResult(assets: $assets, nextPage: $nextPage)';
|
|
|
|
@override
|
|
bool operator ==(covariant SearchResult other) {
|
|
if (identical(this, other)) return true;
|
|
final listEquals = const DeepCollectionEquality().equals;
|
|
|
|
return listEquals(other.assets, assets) && other.nextPage == nextPage;
|
|
}
|
|
|
|
@override
|
|
int get hashCode => assets.hashCode ^ nextPage.hashCode;
|
|
}
|