mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-06 09:15:48 -06:00
90 lines
3.2 KiB
Dart
90 lines
3.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:paperless_api/paperless_api.dart';
|
|
import 'package:paperless_mobile/core/widgets/highlighted_text.dart';
|
|
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
|
import 'package:paperless_mobile/features/document_details/view/widgets/details_item.dart';
|
|
import 'package:paperless_mobile/features/labels/storage_path/view/widgets/storage_path_widget.dart';
|
|
import 'package:paperless_mobile/features/labels/tags/view/widgets/tags_widget.dart';
|
|
import 'package:paperless_mobile/features/labels/view/widgets/label_text.dart';
|
|
import 'package:paperless_mobile/generated/l10n.dart';
|
|
|
|
class DocumentOverviewWidget extends StatelessWidget {
|
|
final DocumentModel document;
|
|
final String? queryString;
|
|
final double itemSpacing;
|
|
const DocumentOverviewWidget({
|
|
super.key,
|
|
required this.document,
|
|
this.queryString,
|
|
required this.itemSpacing,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListView(
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 16,
|
|
horizontal: 16,
|
|
),
|
|
children: [
|
|
DetailsItem(
|
|
label: S.of(context).documentTitlePropertyLabel,
|
|
content: HighlightedText(
|
|
text: document.title,
|
|
highlights: queryString?.split(" ") ?? [],
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
),
|
|
).paddedOnly(bottom: itemSpacing),
|
|
DetailsItem.text(
|
|
DateFormat.yMMMMd().format(document.created),
|
|
context: context,
|
|
label: S.of(context).documentCreatedPropertyLabel,
|
|
).paddedOnly(bottom: itemSpacing),
|
|
Visibility(
|
|
visible: document.documentType != null,
|
|
child: DetailsItem(
|
|
label: S.of(context).documentDocumentTypePropertyLabel,
|
|
content: LabelText<DocumentType>(
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
id: document.documentType,
|
|
),
|
|
).paddedOnly(bottom: itemSpacing),
|
|
),
|
|
Visibility(
|
|
visible: document.correspondent != null,
|
|
child: DetailsItem(
|
|
label: S.of(context).documentCorrespondentPropertyLabel,
|
|
content: LabelText<Correspondent>(
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
id: document.correspondent,
|
|
),
|
|
).paddedOnly(bottom: itemSpacing),
|
|
),
|
|
Visibility(
|
|
visible: document.storagePath != null,
|
|
child: DetailsItem(
|
|
label: S.of(context).documentStoragePathPropertyLabel,
|
|
content: StoragePathWidget(
|
|
pathId: document.storagePath,
|
|
),
|
|
).paddedOnly(bottom: itemSpacing),
|
|
),
|
|
Visibility(
|
|
visible: document.tags.isNotEmpty,
|
|
child: DetailsItem(
|
|
label: S.of(context).documentTagsPropertyLabel,
|
|
content: Padding(
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
child: TagsWidget(
|
|
isClickable: false,
|
|
tagIds: document.tags,
|
|
),
|
|
),
|
|
).paddedOnly(bottom: itemSpacing),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|