Finished inbox, fixed reverse sort order, bloc refactorings

This commit is contained in:
Anton Stubenbord
2022-11-30 01:24:28 +01:00
parent 50190f035e
commit b1db2a1209
27 changed files with 1144 additions and 632 deletions

View File

@@ -79,8 +79,10 @@ class DocumentsCubit extends Cubit<DocumentsState> {
}
final newFilter = state.filter.copyWith(page: state.filter.page + 1);
final result = await documentRepository.find(newFilter);
emit(DocumentsState(
isLoaded: true, value: [...state.value, result], filter: newFilter));
emit(
DocumentsState(
isLoaded: true, value: [...state.value, result], filter: newFilter),
);
}
///

View File

@@ -5,18 +5,18 @@ import 'package:paperless_mobile/core/type/types.dart';
class DocumentModel extends Equatable {
static const idKey = 'id';
static const titleKey = "title";
static const contentKey = "content";
static const archivedFileNameKey = "archived_file_name";
static const asnKey = "archive_serial_number";
static const createdKey = "created";
static const modifiedKey = "modified";
static const addedKey = "added";
static const correspondentKey = "correspondent";
static const titleKey = 'title';
static const contentKey = 'content';
static const archivedFileNameKey = 'archived_file_name';
static const asnKey = 'archive_serial_number';
static const createdKey = 'created';
static const modifiedKey = 'modified';
static const addedKey = 'added';
static const correspondentKey = 'correspondent';
static const originalFileNameKey = 'original_file_name';
static const documentTypeKey = "document_type";
static const tagsKey = "tags";
static const storagePathKey = "storage_path";
static const documentTypeKey = 'document_type';
static const tagsKey = 'tags';
static const storagePathKey = 'storage_path';
final int id;
final String title;
@@ -121,7 +121,7 @@ class DocumentModel extends Equatable {
List<Object?> get props => [
id,
title,
content,
content.hashCode,
tags,
documentType,
storagePath,

View File

@@ -18,6 +18,7 @@ class OnlyNotAssignedTagsQuery extends TagsQuery {
class AnyAssignedTagsQuery extends TagsQuery {
final Iterable<int> tagIds;
const AnyAssignedTagsQuery({
this.tagIds = const [],
});

View File

@@ -37,26 +37,21 @@ class DocumentsPage extends StatefulWidget {
}
class _DocumentsPageState extends State<DocumentsPage> {
final PagingController<int, DocumentModel> _pagingController =
PagingController<int, DocumentModel>(
final _pagingController = PagingController<int, DocumentModel>(
firstPageKey: 1,
);
final PanelController _filterPanelController = PanelController();
final _filterPanelController = PanelController();
@override
void initState() {
super.initState();
_initDocuments();
_pagingController.addPageRequestListener(_loadNewPage);
}
Future<void> _initDocuments() async {
try {
BlocProvider.of<DocumentsCubit>(context).load();
} on ErrorMessage catch (error, stackTrace) {
showErrorMessage(context, error, stackTrace);
}
_pagingController.addPageRequestListener(_loadNewPage);
}
@override
@@ -120,7 +115,10 @@ class _DocumentsPageState extends State<DocumentsPage> {
return Scaffold(
drawer: BlocProvider.value(
value: BlocProvider.of<AuthenticationCubit>(context),
child: const InfoDrawer(),
child: InfoDrawer(
afterInboxClosed: () =>
BlocProvider.of<DocumentsCubit>(context).reload(),
),
),
resizeToAvoidBottomInset: true,
body: SlidingUpPanel(