mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-15 04:12:30 -06:00
Updated onboarding, reformatted files, improved referenced documents view, updated error handling
This commit is contained in:
@@ -76,7 +76,8 @@ class _AddSavedViewPageState extends State<AddSavedViewPage> {
|
||||
SavedView.fromDocumentFilter(
|
||||
widget.currentFilter,
|
||||
name: _formKey.currentState?.value[fkName] as String,
|
||||
showOnDashboard: _formKey.currentState?.value[fkShowOnDashboard] as bool,
|
||||
showOnDashboard:
|
||||
_formKey.currentState?.value[fkShowOnDashboard] as bool,
|
||||
showInSidebar: _formKey.currentState?.value[fkShowInSidebar] as bool,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -6,7 +6,8 @@ import 'package:paperless_mobile/generated/l10n.dart';
|
||||
class BulkDeleteConfirmationDialog extends StatelessWidget {
|
||||
static const _bulletPoint = "\u2022";
|
||||
final DocumentsState state;
|
||||
const BulkDeleteConfirmationDialog({Key? key, required this.state}) : super(key: key);
|
||||
const BulkDeleteConfirmationDialog({Key? key, required this.state})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -19,8 +20,12 @@ class BulkDeleteConfirmationDialog extends StatelessWidget {
|
||||
Text(
|
||||
//TODO: use plurals, didn't use because of crash... investigate later.
|
||||
state.selection.length == 1
|
||||
? S.of(context).documentsPageSelectionBulkDeleteDialogWarningTextOne
|
||||
: S.of(context).documentsPageSelectionBulkDeleteDialogWarningTextMany,
|
||||
? S
|
||||
.of(context)
|
||||
.documentsPageSelectionBulkDeleteDialogWarningTextOne
|
||||
: S
|
||||
.of(context)
|
||||
.documentsPageSelectionBulkDeleteDialogWarningTextMany,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ConstrainedBox(
|
||||
@@ -31,7 +36,8 @@ class BulkDeleteConfirmationDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(S.of(context).documentsPageSelectionBulkDeleteDialogContinueText),
|
||||
Text(
|
||||
S.of(context).documentsPageSelectionBulkDeleteDialogContinueText),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
@@ -41,7 +47,8 @@ class BulkDeleteConfirmationDialog extends StatelessWidget {
|
||||
),
|
||||
TextButton(
|
||||
style: ButtonStyle(
|
||||
foregroundColor: MaterialStateProperty.all(Theme.of(context).colorScheme.error),
|
||||
foregroundColor:
|
||||
MaterialStateProperty.all(Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, true);
|
||||
|
||||
@@ -36,10 +36,11 @@ class _DocumentsPageAppBarState extends State<DocumentsPageAppBar> {
|
||||
expandedHeight: kToolbarHeight,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () => BlocProvider.of<DocumentsCubit>(context).resetSelection(),
|
||||
onPressed: () =>
|
||||
BlocProvider.of<DocumentsCubit>(context).resetSelection(),
|
||||
),
|
||||
title:
|
||||
Text('${documentsState.selection.length} ${S.of(context).documentsSelectedText}'),
|
||||
title: Text(
|
||||
'${documentsState.selection.length} ${S.of(context).documentsSelectedText}'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete),
|
||||
@@ -79,9 +80,8 @@ class _DocumentsPageAppBarState extends State<DocumentsPageAppBar> {
|
||||
if (shouldDelete ?? false) {
|
||||
BlocProvider.of<DocumentsCubit>(context)
|
||||
.bulkRemoveDocuments(documentsState.selection)
|
||||
.then((_) => showSnackBar(context, S.of(context).documentsPageBulkDeleteSuccessfulText))
|
||||
.onError<ErrorMessage>(
|
||||
(error, _) => showSnackBar(context, translateError(context, error.code)));
|
||||
.then((_) => showSnackBar(
|
||||
context, S.of(context).documentsPageBulkDeleteSuccessfulText));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ class SavedViewSelectionWidget extends StatelessWidget {
|
||||
child: FilterChip(
|
||||
label: Text(state.value.values.toList()[index].name),
|
||||
selected: view.id == state.selectedSavedViewId,
|
||||
onSelected: (isSelected) => _onSelected(isSelected, context, view),
|
||||
onSelected: (isSelected) =>
|
||||
_onSelected(isSelected, context, view),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -76,21 +77,19 @@ class SavedViewSelectionWidget extends StatelessWidget {
|
||||
void _onCreatePressed(BuildContext context) async {
|
||||
final newView = await Navigator.of(context).push<SavedView?>(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => AddSavedViewPage(currentFilter: getIt<DocumentsCubit>().state.filter),
|
||||
builder: (context) => AddSavedViewPage(
|
||||
currentFilter: getIt<DocumentsCubit>().state.filter),
|
||||
),
|
||||
);
|
||||
if (newView != null) {
|
||||
try {
|
||||
BlocProvider.of<SavedViewCubit>(context).add(newView);
|
||||
} on ErrorMessage catch (error) {
|
||||
showError(context, error);
|
||||
}
|
||||
BlocProvider.of<SavedViewCubit>(context).add(newView);
|
||||
}
|
||||
}
|
||||
|
||||
void _onSelected(bool isSelected, BuildContext context, SavedView view) {
|
||||
if (isSelected) {
|
||||
BlocProvider.of<DocumentsCubit>(context).updateFilter(filter: view.toDocumentFilter());
|
||||
BlocProvider.of<DocumentsCubit>(context)
|
||||
.updateFilter(filter: view.toDocumentFilter());
|
||||
BlocProvider.of<SavedViewCubit>(context).selectView(view);
|
||||
} else {
|
||||
BlocProvider.of<DocumentsCubit>(context).updateFilter();
|
||||
@@ -106,11 +105,7 @@ class SavedViewSelectionWidget extends StatelessWidget {
|
||||
) ??
|
||||
false;
|
||||
if (delete) {
|
||||
try {
|
||||
BlocProvider.of<SavedViewCubit>(context).remove(view);
|
||||
} on ErrorMessage catch (error) {
|
||||
showError(context, error);
|
||||
}
|
||||
BlocProvider.of<SavedViewCubit>(context).remove(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user