mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 08:07:59 -06:00
feat: Further migrations to go_router, add onclick to document previews
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/routes/typed/branches/documents_route.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
@@ -12,6 +13,7 @@ class DocumentPreview extends StatelessWidget {
|
||||
final double borderRadius;
|
||||
final bool enableHero;
|
||||
final double scale;
|
||||
final bool isClickable;
|
||||
|
||||
const DocumentPreview({
|
||||
super.key,
|
||||
@@ -21,15 +23,23 @@ class DocumentPreview extends StatelessWidget {
|
||||
this.borderRadius = 12.0,
|
||||
this.enableHero = true,
|
||||
this.scale = 1.1,
|
||||
this.isClickable = true,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return HeroMode(
|
||||
enabled: enableHero,
|
||||
child: Hero(
|
||||
tag: "thumb_${document.id}",
|
||||
child: _buildPreview(context),
|
||||
return GestureDetector(
|
||||
onTap: isClickable
|
||||
? () {
|
||||
DocumentPreviewRoute($extra: document).push(context);
|
||||
}
|
||||
: null,
|
||||
child: HeroMode(
|
||||
enabled: enableHero,
|
||||
child: Hero(
|
||||
tag: "thumb_${document.id}",
|
||||
child: _buildPreview(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ class _DocumentFilterPanelState extends State<DocumentFilterPanel> {
|
||||
floatingActionButton: Visibility(
|
||||
visible: MediaQuery.of(context).viewInsets.bottom == 0,
|
||||
child: FloatingActionButton.extended(
|
||||
heroTag: "fab_document_filter_panel",
|
||||
icon: const Icon(Icons.done),
|
||||
label: Text(S.of(context)!.apply),
|
||||
onPressed: _onApplyFilter,
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:paperless_mobile/features/documents/cubit/documents_cubit.dart';
|
||||
import 'package:paperless_mobile/features/documents/view/widgets/selection/bulk_delete_confirmation_dialog.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
import 'package:paperless_mobile/helpers/message_helpers.dart';
|
||||
import 'package:paperless_mobile/routes/typed/branches/documents_route.dart';
|
||||
|
||||
class DocumentSelectionSliverAppBar extends StatelessWidget {
|
||||
final DocumentsState state;
|
||||
@@ -65,24 +66,30 @@ class DocumentSelectionSliverAppBar extends StatelessWidget {
|
||||
label: Text(S.of(context)!.correspondent),
|
||||
avatar: const Icon(Icons.edit),
|
||||
onPressed: () {
|
||||
pushBulkEditCorrespondentRoute(context,
|
||||
selection: state.selection);
|
||||
BulkEditDocumentsRoute(BulkEditExtraWrapper(
|
||||
state.selection,
|
||||
LabelType.correspondent,
|
||||
)).push(context);
|
||||
},
|
||||
).paddedOnly(left: 8, right: 4),
|
||||
ActionChip(
|
||||
label: Text(S.of(context)!.documentType),
|
||||
avatar: const Icon(Icons.edit),
|
||||
onPressed: () async {
|
||||
pushBulkEditDocumentTypeRoute(context,
|
||||
selection: state.selection);
|
||||
BulkEditDocumentsRoute(BulkEditExtraWrapper(
|
||||
state.selection,
|
||||
LabelType.documentType,
|
||||
)).push(context);
|
||||
},
|
||||
).paddedOnly(left: 8, right: 4),
|
||||
ActionChip(
|
||||
label: Text(S.of(context)!.storagePath),
|
||||
avatar: const Icon(Icons.edit),
|
||||
onPressed: () async {
|
||||
pushBulkEditStoragePathRoute(context,
|
||||
selection: state.selection);
|
||||
BulkEditDocumentsRoute(BulkEditExtraWrapper(
|
||||
state.selection,
|
||||
LabelType.storagePath,
|
||||
)).push(context);
|
||||
},
|
||||
).paddedOnly(left: 8, right: 4),
|
||||
_buildBulkEditTagsChip(context).paddedOnly(left: 4, right: 4),
|
||||
@@ -98,7 +105,10 @@ class DocumentSelectionSliverAppBar extends StatelessWidget {
|
||||
label: Text(S.of(context)!.tags),
|
||||
avatar: const Icon(Icons.edit),
|
||||
onPressed: () {
|
||||
pushBulkEditTagsRoute(context, selection: state.selection);
|
||||
BulkEditDocumentsRoute(BulkEditExtraWrapper(
|
||||
state.selection,
|
||||
LabelType.tag,
|
||||
)).push(context);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user