mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 10:08:02 -06:00
Fixed visual bugs, added notifications on document upload success, enabled editing in inbox, added hints
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:intl/date_symbol_data_local.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/widgets/documents_list_loading_widget.dart';
|
||||
import 'package:paperless_mobile/core/widgets/hint_card.dart';
|
||||
import 'package:paperless_mobile/extensions/dart_extensions.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/inbox/bloc/inbox_cubit.dart';
|
||||
@@ -113,7 +114,6 @@ class _InboxPageState extends State<InboxPage> {
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
childCount: entry.value.length,
|
||||
(context, index) => _buildListItem(
|
||||
context,
|
||||
entry.value[index],
|
||||
),
|
||||
),
|
||||
@@ -124,7 +124,7 @@ class _InboxPageState extends State<InboxPage> {
|
||||
.toList();
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => context.read<InboxCubit>().loadInbox(),
|
||||
onRefresh: () => context.read<InboxCubit>().initializeInbox(),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
@@ -132,11 +132,12 @@ class _InboxPageState extends State<InboxPage> {
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: Text(
|
||||
S.of(context).inboxPageUsageHintText,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
).padded(),
|
||||
child: HintCard(
|
||||
show: !state.isHintAcknowledged,
|
||||
hintText: S.of(context).inboxPageUsageHintText,
|
||||
onHintAcknowledged: () =>
|
||||
context.read<InboxCubit>().acknowledgeHint(),
|
||||
),
|
||||
),
|
||||
...slivers
|
||||
],
|
||||
@@ -150,7 +151,7 @@ class _InboxPageState extends State<InboxPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildListItem(BuildContext context, DocumentModel doc) {
|
||||
Widget _buildListItem(DocumentModel doc) {
|
||||
return Dismissible(
|
||||
direction: DismissDirection.endToStart,
|
||||
background: Row(
|
||||
@@ -170,7 +171,12 @@ class _InboxPageState extends State<InboxPage> {
|
||||
).padded(),
|
||||
confirmDismiss: (_) => _onItemDismissed(doc),
|
||||
key: UniqueKey(),
|
||||
child: InboxItem(document: doc),
|
||||
child: InboxItem(
|
||||
document: doc,
|
||||
onDocumentUpdated: (document) {
|
||||
context.read<InboxCubit>().replaceUpdatedDocument(document);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class InboxEmptyWidget extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
key: _emptyStateRefreshIndicatorKey,
|
||||
onRefresh: () => context.read<InboxCubit>().loadInbox(),
|
||||
onRefresh: () => context.read<InboxCubit>().initializeInbox(),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
|
||||
@@ -6,16 +6,18 @@ import 'package:paperless_mobile/core/repository/provider/label_repositories_pro
|
||||
import 'package:paperless_mobile/features/document_details/bloc/document_details_cubit.dart';
|
||||
import 'package:paperless_mobile/features/document_details/view/pages/document_details_page.dart';
|
||||
import 'package:paperless_mobile/features/documents/view/widgets/document_preview.dart';
|
||||
import 'package:paperless_mobile/features/inbox/bloc/inbox_cubit.dart';
|
||||
import 'package:paperless_mobile/features/labels/tags/view/widgets/tags_widget.dart';
|
||||
|
||||
class InboxItem extends StatelessWidget {
|
||||
static const _a4AspectRatio = 1 / 1.4142;
|
||||
|
||||
final void Function(DocumentModel model) onDocumentUpdated;
|
||||
final DocumentModel document;
|
||||
|
||||
const InboxItem({
|
||||
super.key,
|
||||
required this.document,
|
||||
required this.onDocumentUpdated,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -45,23 +47,27 @@ class InboxItem extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => BlocProvider(
|
||||
create: (context) => DocumentDetailsCubit(
|
||||
context.read<PaperlessDocumentsApi>(),
|
||||
document,
|
||||
),
|
||||
child: const LabelRepositoriesProvider(
|
||||
child: DocumentDetailsPage(
|
||||
allowEdit: false,
|
||||
isLabelClickable: false,
|
||||
onTap: () async {
|
||||
final returnedDocument = await Navigator.push<DocumentModel?>(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => BlocProvider(
|
||||
create: (context) => DocumentDetailsCubit(
|
||||
context.read<PaperlessDocumentsApi>(),
|
||||
document,
|
||||
),
|
||||
child: const LabelRepositoriesProvider(
|
||||
child: DocumentDetailsPage(
|
||||
isLabelClickable: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (returnedDocument != null) {
|
||||
onDocumentUpdated(returnedDocument);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user