feat: Allow empty document titles, fix saved view routes not being accessible

This commit is contained in:
Anton Stubenbord
2023-10-10 16:28:10 +02:00
parent 2e32f0c015
commit 7b9c31a010
19 changed files with 278 additions and 300 deletions

View File

@@ -20,7 +20,7 @@ class DeleteDocumentConfirmationDialog extends StatelessWidget {
),
const SizedBox(height: 16),
Text(
document.title ?? document.originalFileName ?? '-',
document.title.isEmpty ? '(no title)' : document.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: const TextStyle(

View File

@@ -111,7 +111,7 @@ class DocumentDetailedItem extends DocumentItem {
],
).paddedLTRB(8, 8, 8, 4),
Text(
document.title ?? '-',
document.title.isEmpty ? '-' : document.title,
style: Theme.of(context).textTheme.titleMedium,
maxLines: 2,
overflow: TextOverflow.ellipsis,

View File

@@ -113,7 +113,7 @@ class DocumentGridItem extends DocumentItem {
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Text(
document.title ?? '-',
document.title.isEmpty ? '-' : document.title,
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.titleMedium,

View File

@@ -58,7 +58,7 @@ class DocumentListItem extends DocumentItem {
],
),
Text(
document.title ?? '-',
document.title.isEmpty ? '-' : document.title,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),

View File

@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:paperless_api/paperless_api.dart';
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
import 'package:paperless_mobile/routes/typed/branches/saved_views_route.dart';
import 'package:paperless_mobile/routes/typed/shells/authenticated_route.dart';
class SavedViewChip extends StatefulWidget {
final SavedView view;

View File

@@ -8,6 +8,7 @@ import 'package:paperless_mobile/features/saved_view/cubit/saved_view_cubit.dart
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
import 'package:paperless_mobile/helpers/connectivity_aware_action_wrapper.dart';
import 'package:paperless_mobile/routes/typed/branches/saved_views_route.dart';
import 'package:paperless_mobile/routes/typed/shells/authenticated_route.dart';
class SavedViewsWidget extends StatefulWidget {
final void Function(SavedView view) onViewSelected;
@@ -184,7 +185,8 @@ class _SavedViewsWidgetState extends State<SavedViewsWidget>
child: ConnectivityAwareActionWrapper(
child: TextButton.icon(
onPressed: () {
CreateSavedViewRoute(widget.filter).push(context);
CreateSavedViewRoute($extra: widget.filter)
.push(context);
},
icon: const Icon(Icons.add),
label: Text(S.of(context)!.newView),

View File

@@ -44,7 +44,7 @@ class BulkDeleteConfirmationDialog extends StatelessWidget {
return ListTile(
dense: true,
title: Text(
doc.title ?? doc.originalFileName ?? '-',
doc.title.isEmpty ? '-' : doc.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(