mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-09 08:08:14 -06:00
feat: Replaced old label form fields with full page search, removed badge from edit button in document details
This commit is contained in:
@@ -24,12 +24,7 @@ class DocumentsCubit extends HydratedCubit<DocumentsState>
|
||||
final DocumentChangedNotifier notifier;
|
||||
|
||||
DocumentsCubit(this.api, this.notifier, this._labelRepository)
|
||||
: super(DocumentsState(
|
||||
correspondents: _labelRepository.state.correspondents,
|
||||
documentTypes: _labelRepository.state.documentTypes,
|
||||
storagePaths: _labelRepository.state.storagePaths,
|
||||
tags: _labelRepository.state.tags,
|
||||
)) {
|
||||
: super(const DocumentsState()) {
|
||||
notifier.addListener(
|
||||
this,
|
||||
onUpdated: (document) {
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
part of 'documents_cubit.dart';
|
||||
|
||||
@JsonSerializable(ignoreUnannotated: true)
|
||||
@JsonSerializable()
|
||||
class DocumentsState extends DocumentPagingState {
|
||||
@JsonKey(includeToJson: false, includeFromJson: false)
|
||||
final List<DocumentModel> selection;
|
||||
|
||||
@JsonKey(includeToJson: false, includeFromJson: false)
|
||||
final Map<int, Correspondent> correspondents;
|
||||
@JsonKey(includeToJson: false, includeFromJson: false)
|
||||
final Map<int, DocumentType> documentTypes;
|
||||
@JsonKey(includeToJson: false, includeFromJson: false)
|
||||
final Map<int, Tag> tags;
|
||||
@JsonKey(includeToJson: false, includeFromJson: false)
|
||||
final Map<int, StoragePath> storagePaths;
|
||||
|
||||
@JsonKey()
|
||||
final ViewType viewType;
|
||||
|
||||
const DocumentsState({
|
||||
@@ -53,15 +57,14 @@ class DocumentsState extends DocumentPagingState {
|
||||
);
|
||||
}
|
||||
|
||||
factory DocumentsState.fromJson(Map<String, dynamic> json) =>
|
||||
_$DocumentsStateFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$DocumentsStateToJson(this);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
selection,
|
||||
viewType,
|
||||
correspondents,
|
||||
documentTypes,
|
||||
tags,
|
||||
storagePaths,
|
||||
...super.props,
|
||||
];
|
||||
|
||||
@@ -79,4 +82,9 @@ class DocumentsState extends DocumentPagingState {
|
||||
value: value,
|
||||
);
|
||||
}
|
||||
|
||||
factory DocumentsState.fromJson(Map<String, dynamic> json) =>
|
||||
_$DocumentsStateFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$DocumentsStateToJson(this);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ class SliverAdaptiveDocumentsView extends AdaptiveDocumentsView {
|
||||
Widget _buildFullView(BuildContext context) {
|
||||
if (showLoadingPlaceholder) {
|
||||
//TODO: Build detailed loading animation
|
||||
return DocumentsListLoadingWidget.sliver();
|
||||
return const DocumentsListLoadingWidget.sliver();
|
||||
}
|
||||
return SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:paperless_mobile/features/labels/tags/view/widgets/tags_widget.d
|
||||
class DocumentListItem extends DocumentItem {
|
||||
static const _a4AspectRatio = 1 / 1.4142;
|
||||
|
||||
const DocumentListItem({
|
||||
DocumentListItem({
|
||||
super.key,
|
||||
required super.document,
|
||||
required super.isSelected,
|
||||
@@ -28,7 +28,9 @@ class DocumentListItem extends DocumentItem {
|
||||
required super.correspondents,
|
||||
required super.documentTypes,
|
||||
required super.storagePaths,
|
||||
});
|
||||
}) {
|
||||
print(tags.keys.join(", "));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -64,11 +66,14 @@ class DocumentListItem extends DocumentItem {
|
||||
absorbing: isSelectionActive,
|
||||
child: TagsWidget(
|
||||
isClickable: isLabelClickable,
|
||||
tags: document.tags.map((e) => tags[e]!).toList(),
|
||||
tags: document.tags
|
||||
.where((e) => tags.containsKey(e))
|
||||
.map((e) => tags[e]!)
|
||||
.toList(),
|
||||
isMultiLine: false,
|
||||
onTagSelected: (id) => onTagSelected?.call(id),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: Padding(
|
||||
|
||||
@@ -155,10 +155,9 @@ class _DocumentFilterFormState extends State<DocumentFilterForm> {
|
||||
|
||||
Widget _buildDocumentTypeFormField() {
|
||||
return LabelFormField<DocumentType>(
|
||||
formBuilderState: widget.formKey.currentState,
|
||||
name: DocumentFilterForm.fkDocumentType,
|
||||
labelOptions: widget.documentTypes,
|
||||
textFieldLabel: S.of(context)!.documentType,
|
||||
options: widget.documentTypes,
|
||||
labelText: S.of(context)!.documentType,
|
||||
initialValue: widget.initialFilter.documentType,
|
||||
prefixIcon: const Icon(Icons.description_outlined),
|
||||
);
|
||||
@@ -166,10 +165,9 @@ class _DocumentFilterFormState extends State<DocumentFilterForm> {
|
||||
|
||||
Widget _buildCorrespondentFormField() {
|
||||
return LabelFormField<Correspondent>(
|
||||
formBuilderState: widget.formKey.currentState,
|
||||
name: DocumentFilterForm.fkCorrespondent,
|
||||
labelOptions: widget.correspondents,
|
||||
textFieldLabel: S.of(context)!.correspondent,
|
||||
options: widget.correspondents,
|
||||
labelText: S.of(context)!.correspondent,
|
||||
initialValue: widget.initialFilter.correspondent,
|
||||
prefixIcon: const Icon(Icons.person_outline),
|
||||
);
|
||||
@@ -177,10 +175,9 @@ class _DocumentFilterFormState extends State<DocumentFilterForm> {
|
||||
|
||||
Widget _buildStoragePathFormField() {
|
||||
return LabelFormField<StoragePath>(
|
||||
formBuilderState: widget.formKey.currentState,
|
||||
name: DocumentFilterForm.fkStoragePath,
|
||||
labelOptions: widget.storagePaths,
|
||||
textFieldLabel: S.of(context)!.storagePath,
|
||||
options: widget.storagePaths,
|
||||
labelText: S.of(context)!.storagePath,
|
||||
initialValue: widget.initialFilter.storagePath,
|
||||
prefixIcon: const Icon(Icons.folder_outlined),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user