mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 20:07:55 -06:00
feat+fix: Add option to set default download/share file type, fix typo in filter to query string, disable unused options in document filter
This commit is contained in:
@@ -1,25 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_mobile/features/settings/view/widgets/radio_settings_dialog.dart';
|
||||
import 'package:paperless_mobile/core/widgets/dialog_utils/dialog_cancel_button.dart';
|
||||
import 'package:paperless_mobile/features/settings/model/file_download_type.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
class SelectFileTypeDialog extends StatelessWidget {
|
||||
const SelectFileTypeDialog({super.key});
|
||||
class SelectFileTypeDialog extends StatefulWidget {
|
||||
final void Function(FileDownloadType downloadType) onRememberSelection;
|
||||
const SelectFileTypeDialog({super.key, required this.onRememberSelection});
|
||||
|
||||
@override
|
||||
State<SelectFileTypeDialog> createState() => _SelectFileTypeDialogState();
|
||||
}
|
||||
|
||||
class _SelectFileTypeDialogState extends State<SelectFileTypeDialog> {
|
||||
bool _rememberSelection = false;
|
||||
FileDownloadType _downloadType = FileDownloadType.original;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RadioSettingsDialog(
|
||||
titleText: S.of(context)!.chooseFiletype,
|
||||
options: [
|
||||
RadioOption(
|
||||
value: true,
|
||||
label: S.of(context)!.original,
|
||||
),
|
||||
RadioOption(
|
||||
value: false,
|
||||
label: S.of(context)!.archivedPdf,
|
||||
return AlertDialog(
|
||||
title: Text(S.of(context)!.chooseFiletype),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
RadioListTile(
|
||||
value: FileDownloadType.original,
|
||||
groupValue: _downloadType,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
setState(() => _downloadType = value);
|
||||
}
|
||||
},
|
||||
title: Text(S.of(context)!.original),
|
||||
),
|
||||
RadioListTile(
|
||||
value: FileDownloadType.archived,
|
||||
groupValue: _downloadType,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
setState(() => _downloadType = value);
|
||||
}
|
||||
},
|
||||
title: Text(S.of(context)!.archivedPdf),
|
||||
),
|
||||
Divider(),
|
||||
CheckboxListTile(
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
value: _rememberSelection,
|
||||
onChanged: (value) => setState(() => _rememberSelection = value ?? false),
|
||||
title: Text(
|
||||
"Remember my decision",
|
||||
style: Theme.of(context).textTheme.labelMedium,
|
||||
), //TODO: INTL
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
const DialogCancelButton(),
|
||||
ElevatedButton(
|
||||
child: Text(S.of(context)!.select),
|
||||
onPressed: () {
|
||||
if (_rememberSelection) {
|
||||
widget.onRememberSelection(_downloadType);
|
||||
}
|
||||
Navigator.of(context).pop(_downloadType == FileDownloadType.original);
|
||||
},
|
||||
),
|
||||
],
|
||||
initialValue: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user