mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-15 12:12:30 -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:
@@ -15,6 +15,7 @@ class FullscreenLabelForm<T extends Label> extends StatefulWidget {
|
||||
final Widget leadingIcon;
|
||||
final String? addNewLabelText;
|
||||
final bool autofocus;
|
||||
final bool allowSelectUnassigned;
|
||||
|
||||
FullscreenLabelForm({
|
||||
super.key,
|
||||
@@ -27,6 +28,7 @@ class FullscreenLabelForm<T extends Label> extends StatefulWidget {
|
||||
required this.leadingIcon,
|
||||
this.addNewLabelText,
|
||||
this.autofocus = true,
|
||||
this.allowSelectUnassigned = true,
|
||||
}) : assert(
|
||||
!(initialValue?.isOnlyAssigned() ?? false) || showAnyAssignedOption,
|
||||
),
|
||||
@@ -248,16 +250,26 @@ class _FullscreenLabelFormState<T extends Label> extends State<FullscreenLabelFo
|
||||
);
|
||||
}
|
||||
|
||||
final title = option.whenOrNull(
|
||||
notAssigned: () => S.of(context)!.notAssigned,
|
||||
anyAssigned: () => S.of(context)!.anyAssigned,
|
||||
fromId: (id) => widget.options[id]!.name,
|
||||
return option.whenOrNull(
|
||||
notAssigned: () => ListTile(
|
||||
selected: highlight,
|
||||
selectedTileColor: Theme.of(context).focusColor,
|
||||
title: Text(S.of(context)!.notAssigned),
|
||||
onTap: onTap,
|
||||
),
|
||||
anyAssigned: () => ListTile(
|
||||
selected: highlight,
|
||||
selectedTileColor: Theme.of(context).focusColor,
|
||||
title: Text(S.of(context)!.anyAssigned),
|
||||
onTap: onTap,
|
||||
),
|
||||
fromId: (id) => ListTile(
|
||||
selected: highlight,
|
||||
selectedTileColor: Theme.of(context).focusColor,
|
||||
title: Text(widget.options[id]!.name),
|
||||
onTap: onTap,
|
||||
enabled: widget.allowSelectUnassigned ? true : widget.options[id]!.documentCount == 0,
|
||||
),
|
||||
)!; // Never null, since we already return on unset before
|
||||
return ListTile(
|
||||
selected: highlight,
|
||||
selectedTileColor: Theme.of(context).focusColor,
|
||||
title: Text(title),
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ class LabelFormField<T extends Label> extends StatelessWidget {
|
||||
final bool showAnyAssignedOption;
|
||||
final List<T> suggestions;
|
||||
final String? addLabelText;
|
||||
final bool allowSelectUnassigned;
|
||||
|
||||
const LabelFormField({
|
||||
Key? key,
|
||||
@@ -42,6 +43,7 @@ class LabelFormField<T extends Label> extends StatelessWidget {
|
||||
this.showAnyAssignedOption = true,
|
||||
this.suggestions = const [],
|
||||
this.addLabelText,
|
||||
required this.allowSelectUnassigned,
|
||||
}) : super(key: key);
|
||||
|
||||
String _buildText(BuildContext context, IdQueryParameter? value) {
|
||||
@@ -100,6 +102,7 @@ class LabelFormField<T extends Label> extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
openBuilder: (context, closeForm) => FullscreenLabelForm<T>(
|
||||
allowSelectUnassigned: allowSelectUnassigned,
|
||||
addNewLabelText: addLabelText,
|
||||
leadingIcon: prefixIcon,
|
||||
onCreateNewLabel: addLabelPageBuilder != null
|
||||
|
||||
Reference in New Issue
Block a user