1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-17 12:22:31 +02:00
immich/mobile/lib/modules/search/models/search_result_page_state.model.dart

62 lines
1.6 KiB
Dart
Raw Normal View History

2022-03-03 00:44:24 +02:00
import 'package:collection/collection.dart';
import 'package:immich_mobile/shared/models/asset.dart';
2022-03-03 00:44:24 +02:00
class SearchResultPageState {
2022-03-03 00:44:24 +02:00
final bool isLoading;
final bool isSuccess;
final bool isError;
final bool isSmart;
final List<Asset> searchResult;
2022-03-03 00:44:24 +02:00
SearchResultPageState({
2022-03-03 00:44:24 +02:00
required this.isLoading,
required this.isSuccess,
required this.isError,
required this.isSmart,
2022-03-03 00:44:24 +02:00
required this.searchResult,
});
SearchResultPageState copyWith({
2022-03-03 00:44:24 +02:00
bool? isLoading,
bool? isSuccess,
bool? isError,
bool? isSmart,
List<Asset>? searchResult,
2022-03-03 00:44:24 +02:00
}) {
return SearchResultPageState(
2022-03-03 00:44:24 +02:00
isLoading: isLoading ?? this.isLoading,
isSuccess: isSuccess ?? this.isSuccess,
isError: isError ?? this.isError,
isSmart: isSmart ?? this.isSmart,
2022-03-03 00:44:24 +02:00
searchResult: searchResult ?? this.searchResult,
);
}
@override
String toString() {
return 'SearchresultPageState(isLoading: $isLoading, isSuccess: $isSuccess, isError: $isError, isSmart: $isSmart, searchResult: $searchResult)';
2022-03-03 00:44:24 +02:00
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
final listEquals = const DeepCollectionEquality().equals;
return other is SearchResultPageState &&
2022-03-03 00:44:24 +02:00
other.isLoading == isLoading &&
other.isSuccess == isSuccess &&
other.isError == isError &&
other.isSmart == isSmart &&
2022-03-03 00:44:24 +02:00
listEquals(other.searchResult, searchResult);
}
@override
int get hashCode {
return isLoading.hashCode ^
isSuccess.hashCode ^
isError.hashCode ^
isSmart.hashCode ^
searchResult.hashCode;
2022-03-03 00:44:24 +02:00
}
}