Changed saved views handling, changed repository structure with automatic persistence.

This commit is contained in:
Anton Stubenbord
2023-01-08 00:01:04 +01:00
parent 23bcb355b1
commit 3c6c4e63d7
74 changed files with 1374 additions and 863 deletions

View File

@@ -2,34 +2,29 @@ import 'package:equatable/equatable.dart';
import 'package:paperless_api/paperless_api.dart';
class SavedViewState with EquatableMixin {
final bool isLoaded;
final bool hasLoaded;
final Map<int, SavedView> value;
final int? selectedSavedViewId;
SavedViewState({
required this.value,
this.isLoaded = false,
this.selectedSavedViewId,
const SavedViewState({
this.value = const {},
this.hasLoaded = false,
});
@override
List<Object?> get props => [
hasLoaded,
value,
selectedSavedViewId,
];
SavedViewState copyWith({
Map<int, SavedView>? value,
int? selectedSavedViewId,
bool overwriteSelectedSavedViewId = false,
bool? isLoaded,
bool? hasLoaded,
}) {
return SavedViewState(
value: value ?? this.value,
isLoaded: isLoaded ?? this.isLoaded,
selectedSavedViewId: overwriteSelectedSavedViewId
? selectedSavedViewId
: this.selectedSavedViewId,
hasLoaded: hasLoaded ?? this.hasLoaded,
);
}
}