feat: Update translations, finish saved views rework, some other fixes

This commit is contained in:
Anton Stubenbord
2023-09-22 00:46:24 +02:00
parent f3560f00ea
commit 18ab657932
55 changed files with 2049 additions and 1087 deletions

View File

@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:paperless_mobile/core/widgets/dialog_utils/unsaved_changes_warning_dialog.dart';
class PopWithUnsavedChanges extends StatelessWidget {
final bool Function() hasChangesPredicate;
final Widget child;
const PopWithUnsavedChanges({
super.key,
required this.hasChangesPredicate,
required this.child,
});
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
if (hasChangesPredicate()) {
final shouldPop = await showDialog<bool>(
context: context,
builder: (context) => const UnsavedChangesWarningDialog(),
) ??
false;
return shouldPop;
}
return true;
},
child: child,
);
}
}

View File

@@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:paperless_mobile/core/widgets/dialog_utils/dialog_cancel_button.dart';
import 'package:paperless_mobile/core/widgets/dialog_utils/dialog_confirm_button.dart';
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
class UnsavedChangesWarningDialog extends StatelessWidget {
const UnsavedChangesWarningDialog({super.key});
@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text("Discard changes?"),
content: Text(
"You have unsaved changes. Do you want to continue without saving? Your changes will be discarded.",
),
actions: [
DialogCancelButton(),
DialogConfirmButton(
label: S.of(context)!.continueLabel,
),
],
);
}
}