Changed loading animation, directly accessible pages and updated translations

This commit is contained in:
Anton Stubenbord
2023-01-24 22:03:34 +01:00
parent e68e3af713
commit a7b980ae71
12 changed files with 110 additions and 64 deletions

View File

@@ -1,10 +1,9 @@
//TODO: REMOVE THIS WHEN NATIVE MATERIAL FLUTTER SEARCH IS RELEASED
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
/// Shows a full screen search page and returns the search result selected by
/// the user when the page is closed.
@@ -381,7 +380,7 @@ enum _SearchBody {
class _SearchPageRoute<T> extends PageRoute<T> {
_SearchPageRoute({
required this.delegate,
}) : assert(delegate != null) {
}) {
assert(
delegate._route == null,
'The ${delegate.runtimeType} instance is currently used by another active '

View File

@@ -47,7 +47,7 @@ class DocumentSearchDelegate extends m3.SearchDelegate<DocumentModel> {
slivers: [
SliverToBoxAdapter(
child: Text(
"History", //TODO: INTL
S.of(context).documentSearchHistory,
style: Theme.of(context).textTheme.labelMedium,
).padded(16),
),
@@ -111,7 +111,7 @@ class DocumentSearchDelegate extends m3.SearchDelegate<DocumentModel> {
slivers: [
SliverToBoxAdapter(
child: Text(
"Results", //TODO: INTL
S.of(context).documentSearchResults,
style: Theme.of(context).textTheme.labelMedium,
).padded(),
),

View File

@@ -4,8 +4,8 @@ import 'package:paperless_mobile/features/document_search/cubit/document_search_
import 'package:paperless_mobile/features/document_search/document_search_delegate.dart';
import 'package:provider/provider.dart';
class DocumentSearchAppBar extends StatelessWidget {
const DocumentSearchAppBar({
class DocumentSearchBar extends StatelessWidget {
const DocumentSearchBar({
super.key,
});
@@ -34,7 +34,7 @@ class DocumentSearchAppBar extends StatelessWidget {
borderSide: BorderSide.none,
),
prefixIcon: IconButton(
icon: const Icon(Icons.menu),
icon: const Icon(Icons.search),
onPressed: () {
Scaffold.of(context).openDrawer();
},

View File

@@ -11,7 +11,7 @@ import 'package:paperless_mobile/features/document_details/bloc/document_details
import 'package:paperless_mobile/features/document_details/view/pages/document_details_page.dart';
import 'package:paperless_mobile/features/document_search/cubit/document_search_cubit.dart';
import 'package:paperless_mobile/features/document_search/document_search_delegate.dart';
import 'package:paperless_mobile/features/document_search/view/document_search_app_bar.dart';
import 'package:paperless_mobile/features/document_search/view/document_search_bar.dart';
import 'package:paperless_mobile/features/documents/bloc/documents_cubit.dart';
import 'package:paperless_mobile/features/documents/bloc/documents_state.dart';
import 'package:paperless_mobile/features/documents/view/widgets/documents_empty_state.dart';
@@ -30,6 +30,7 @@ import 'package:paperless_mobile/features/settings/bloc/application_settings_sta
import 'package:paperless_mobile/features/settings/model/view_type.dart';
import 'package:paperless_mobile/features/tasks/cubit/task_status_cubit.dart';
import 'package:paperless_mobile/generated/l10n.dart';
import 'package:paperless_mobile/helpers/format_helpers.dart';
import 'package:paperless_mobile/helpers/message_helpers.dart';
import 'package:paperless_mobile/constants.dart';
@@ -152,9 +153,24 @@ class _DocumentsPageState extends State<DocumentsPage> {
builder: (context, state) {
if (state.selection.isEmpty) {
return AppBar(
automaticallyImplyLeading: false,
title: const DocumentSearchAppBar(),
automaticallyImplyLeading: true,
title: Text(S.of(context).documentsPageTitle +
" (${formatMaxCount(state.documents.length)})"),
actions: [
IconButton(
icon: const Icon(Icons.search),
onPressed: () {
showMaterial3Search(
context: context,
delegate: DocumentSearchDelegate(
DocumentSearchCubit(context.read()),
searchFieldStyle:
Theme.of(context).textTheme.bodyLarge,
hintText: "Search documents",
),
);
},
),
const SortDocumentsButton(),
BlocBuilder<ApplicationSettingsCubit,
ApplicationSettingsState>(

View File

@@ -7,12 +7,12 @@ import 'package:paperless_mobile/features/documents/view/widgets/list/document_l
import 'package:paperless_mobile/features/settings/model/view_type.dart';
class AdaptiveDocumentsView extends StatelessWidget {
final DocumentsState state;
final ViewType viewType;
final Widget beforeItems;
final void Function(DocumentModel) onTap;
final void Function(DocumentModel) onSelected;
final ScrollController scrollController;
final DocumentsState state;
final bool hasInternetConnection;
final bool isLabelClickable;
final void Function(int id)? onTagSelected;
@@ -46,6 +46,8 @@ class AdaptiveDocumentsView extends StatelessWidget {
slivers: [
SliverToBoxAdapter(child: beforeItems),
if (viewType == ViewType.list) _buildListView() else _buildGridView(),
if (state.hasLoaded && state.isLoading)
SliverToBoxAdapter(child: pageLoadingWidget),
],
);
}

View File

@@ -1,10 +1,11 @@
import 'package:flutter/material.dart';
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
class NewItemsLoadingWidget extends StatelessWidget {
const NewItemsLoadingWidget({super.key});
@override
Widget build(BuildContext context) {
return const CircularProgressIndicator();
return Center(child: const CircularProgressIndicator().padded());
}
}

View File

@@ -182,14 +182,14 @@ class _HomePageState extends State<HomePage> {
),
label: S.of(context).bottomNavInboxPageLabel,
),
RouteDescription(
icon: const Icon(Icons.settings_outlined),
selectedIcon: Icon(
Icons.settings,
color: Theme.of(context).colorScheme.primary,
),
label: S.of(context).appDrawerSettingsLabel,
),
// RouteDescription(
// icon: const Icon(Icons.settings_outlined),
// selectedIcon: Icon(
// Icons.settings,
// color: Theme.of(context).colorScheme.primary,
// ),
// label: S.of(context).appDrawerSettingsLabel,
// ),
];
final routes = <Widget>[
MultiBlocProvider(
@@ -222,7 +222,7 @@ class _HomePageState extends State<HomePage> {
),
child: const InboxPage(),
),
const SettingsPage(),
// const SettingsPage(),
];
return MultiBlocListener(
listeners: [
@@ -270,7 +270,7 @@ class _HomePageState extends State<HomePage> {
}
return Scaffold(
bottomNavigationBar: NavigationBar(
labelBehavior: NavigationDestinationLabelBehavior.alwaysHide,
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
elevation: 4.0,
selectedIndex: _currentIndex,
onDestinationSelected: _onNavigationChanged,

View File

@@ -1,7 +1,6 @@
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
import 'package:paperless_api/paperless_api.dart';
import 'package:paperless_mobile/core/widgets/documents_list_loading_widget.dart';
@@ -14,7 +13,6 @@ import 'package:paperless_mobile/features/inbox/view/widgets/inbox_empty_widget.
import 'package:paperless_mobile/features/inbox/view/widgets/inbox_item.dart';
import 'package:paperless_mobile/generated/l10n.dart';
import 'package:paperless_mobile/helpers/message_helpers.dart';
import 'package:paperless_mobile/constants.dart';
class InboxPage extends StatefulWidget {
const InboxPage({super.key});
@@ -65,10 +63,6 @@ class _InboxPageState extends State<InboxPage> {
builder: (context, state) {
return AppBar(
title: Text(S.of(context).bottomNavInboxPageLabel),
leading: IconButton(
icon: const Icon(Icons.close),
onPressed: () => Navigator.pop(context),
),
actions: [
if (state.hasLoaded)
Align(
@@ -89,12 +83,6 @@ class _InboxPageState extends State<InboxPage> {
),
).paddedSymmetrically(horizontal: 8)
],
bottom: PreferredSize(
preferredSize: const Size.fromHeight(4),
child: state.isLoading && state.hasLoaded
? const LinearProgressIndicator()
: const SizedBox(height: _progressBarHeight),
),
);
},
),

View File

@@ -44,6 +44,10 @@
"@bottomNavLabelsPageLabel": {},
"bottomNavScannerPageLabel": "Skener",
"@bottomNavScannerPageLabel": {},
"colorSchemeOptionClassic": "Classic",
"@colorSchemeOptionClassic": {},
"colorSchemeOptionDynamic": "Dynamic",
"@colorSchemeOptionDynamic": {},
"correspondentFormFieldSearchHintText": "Začni psát...",
"@correspondentFormFieldSearchHintText": {},
"deleteViewDialogContentText": "Opravdu chceš tento náhled smazat?",
@@ -144,6 +148,12 @@
"@documentScannerPageUploadButtonTooltip": {},
"documentScannerPageUploadFromThisDeviceButtonLabel": "Nahrát jeden dokument z tohoto zařízení",
"@documentScannerPageUploadFromThisDeviceButtonLabel": {},
"documentSearchHistory": "History",
"@documentSearchHistory": {},
"documentSearchPageRemoveFromHistory": "Remove from search history?",
"@documentSearchPageRemoveFromHistory": {},
"documentSearchResults": "Results",
"@documentSearchResults": {},
"documentsEmptyStateResetFilterLabel": "Zrušit",
"@documentsEmptyStateResetFilterLabel": {},
"documentsFilterPageAdvancedLabel": "Rozšířené",
@@ -570,6 +580,12 @@
"@settingsPageApplicationSettingsDescriptionText": {},
"settingsPageApplicationSettingsLabel": "Aplikace",
"@settingsPageApplicationSettingsLabel": {},
"settingsPageColorSchemeSettingDialogDescription": "Choose between a classic color scheme inspired by a traditional Paperless green or use the dynamic color scheme based on your system theme.",
"@settingsPageColorSchemeSettingDialogDescription": {},
"settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": "Dynamic theming is only supported for devices running Android 12 and above. Selecting the 'Dynamic' option might not have any effect depending on your OS implementation.",
"@settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": {},
"settingsPageColorSchemeSettingLabel": "Colors",
"@settingsPageColorSchemeSettingLabel": {},
"settingsPageLanguageSettingLabel": "Jazyk",
"@settingsPageLanguageSettingLabel": {},
"settingsPageSecuritySettingsDescriptionText": "Biometrické ověření",
@@ -611,11 +627,5 @@
"verifyIdentityPageTitle": "Ověř svou identitu",
"@verifyIdentityPageTitle": {},
"verifyIdentityPageVerifyIdentityButtonLabel": "Ověřit identitu",
"@verifyIdentityPageVerifyIdentityButtonLabel": {},
"settingsPageColorSchemeSettingLabel": "Colors",
"colorSchemeOptionClassic": "Classic",
"colorSchemeOptionDznamic": "Dynamic",
"settingsPageColorSchemeSettingDialogDescription": "Choose between the classic color scheme in Paperless inspired green or use the dynamic color scheme based on your system theme.",
"settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": "Dynamic theming is only supported for devices running Android 12 and above. Using the 'dynamic' option might not have any effect depending on your OS implementation.",
"documentSearchPageRemoveFromHistory": "Remove from search history?"
"@verifyIdentityPageVerifyIdentityButtonLabel": {}
}

View File

@@ -40,10 +40,14 @@
"@bottomNavDocumentsPageLabel": {},
"bottomNavInboxPageLabel": "Posteingang",
"@bottomNavInboxPageLabel": {},
"bottomNavLabelsPageLabel": "Kennzeichnungen",
"bottomNavLabelsPageLabel": "Labels",
"@bottomNavLabelsPageLabel": {},
"bottomNavScannerPageLabel": "Scanner",
"@bottomNavScannerPageLabel": {},
"colorSchemeOptionClassic": "Klassisch",
"@colorSchemeOptionClassic": {},
"colorSchemeOptionDynamic": "Dynamisch",
"@colorSchemeOptionDynamic": {},
"correspondentFormFieldSearchHintText": "Beginne zu tippen...",
"@correspondentFormFieldSearchHintText": {},
"deleteViewDialogContentText": "Möchtest Du diese Ansicht wirklich löschen?",
@@ -144,6 +148,12 @@
"@documentScannerPageUploadButtonTooltip": {},
"documentScannerPageUploadFromThisDeviceButtonLabel": "Lade ein Dokument von diesem Gerät hoch",
"@documentScannerPageUploadFromThisDeviceButtonLabel": {},
"documentSearchHistory": "Verlauf",
"@documentSearchHistory": {},
"documentSearchPageRemoveFromHistory": "Aus dem Suchverlauf entfernen?",
"@documentSearchPageRemoveFromHistory": {},
"documentSearchResults": "Ergebnisse",
"@documentSearchResults": {},
"documentsEmptyStateResetFilterLabel": "Filter zurücksetzen",
"@documentsEmptyStateResetFilterLabel": {},
"documentsFilterPageAdvancedLabel": "Erweitert",
@@ -570,6 +580,12 @@
"@settingsPageApplicationSettingsDescriptionText": {},
"settingsPageApplicationSettingsLabel": "Anwendung",
"@settingsPageApplicationSettingsLabel": {},
"settingsPageColorSchemeSettingDialogDescription": "Wähle zwischen einem klassischen Farbschema, das vom traditionellen Paperless-Grün inspiriert ist, oder einem dynamische Farbschema basierend auf den Systemfarben.",
"@settingsPageColorSchemeSettingDialogDescription": {},
"settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": "Dynamische Farbgebung wird nur von Geräten mit Android 12 und höher unterstützt. Das Auswählen des dynamischen Farbschemas hat für Geräte unter Android 12 womöglich keinen Effekt.",
"@settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": {},
"settingsPageColorSchemeSettingLabel": "Farben",
"@settingsPageColorSchemeSettingLabel": {},
"settingsPageLanguageSettingLabel": "Sprache",
"@settingsPageLanguageSettingLabel": {},
"settingsPageSecuritySettingsDescriptionText": "Biometrische Authentifizierung",
@@ -611,11 +627,5 @@
"verifyIdentityPageTitle": "Verifiziere deine Identität",
"@verifyIdentityPageTitle": {},
"verifyIdentityPageVerifyIdentityButtonLabel": "Identität verifizieren",
"@verifyIdentityPageVerifyIdentityButtonLabel": {},
"settingsPageColorSchemeSettingLabel": "Colors",
"colorSchemeOptionClassic": "Classic",
"colorSchemeOptionDznamic": "Dynamic",
"settingsPageColorSchemeSettingDialogDescription": "Choose between the classic color scheme in Paperless inspired green or use the dynamic color scheme based on your system theme.",
"settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": "Dynamic theming is only supported for devices running Android 12 and above. Using the 'dynamic' option might not have any effect depending on your OS implementation.",
"documentSearchPageRemoveFromHistory": "Remove from search history?"
"@verifyIdentityPageVerifyIdentityButtonLabel": {}
}

View File

@@ -44,6 +44,10 @@
"@bottomNavLabelsPageLabel": {},
"bottomNavScannerPageLabel": "Scanner",
"@bottomNavScannerPageLabel": {},
"colorSchemeOptionClassic": "Classic",
"@colorSchemeOptionClassic": {},
"colorSchemeOptionDynamic": "Dynamic",
"@colorSchemeOptionDynamic": {},
"correspondentFormFieldSearchHintText": "Start typing...",
"@correspondentFormFieldSearchHintText": {},
"deleteViewDialogContentText": "Do you really want to delete this view?",
@@ -144,6 +148,12 @@
"@documentScannerPageUploadButtonTooltip": {},
"documentScannerPageUploadFromThisDeviceButtonLabel": "Upload a document from this device",
"@documentScannerPageUploadFromThisDeviceButtonLabel": {},
"documentSearchHistory": "History",
"@documentSearchHistory": {},
"documentSearchPageRemoveFromHistory": "Remove from search history?",
"@documentSearchPageRemoveFromHistory": {},
"documentSearchResults": "Results",
"@documentSearchResults": {},
"documentsEmptyStateResetFilterLabel": "Reset filter",
"@documentsEmptyStateResetFilterLabel": {},
"documentsFilterPageAdvancedLabel": "Advanced",
@@ -570,6 +580,12 @@
"@settingsPageApplicationSettingsDescriptionText": {},
"settingsPageApplicationSettingsLabel": "Application",
"@settingsPageApplicationSettingsLabel": {},
"settingsPageColorSchemeSettingDialogDescription": "Choose between a classic color scheme inspired by a traditional Paperless green or use the dynamic color scheme based on your system theme.",
"@settingsPageColorSchemeSettingDialogDescription": {},
"settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": "Dynamic theming is only supported for devices running Android 12 and above. Selecting the 'Dynamic' option might not have any effect depending on your OS implementation.",
"@settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": {},
"settingsPageColorSchemeSettingLabel": "Colors",
"@settingsPageColorSchemeSettingLabel": {},
"settingsPageLanguageSettingLabel": "Language",
"@settingsPageLanguageSettingLabel": {},
"settingsPageSecuritySettingsDescriptionText": "Biometric authentication",
@@ -611,11 +627,5 @@
"verifyIdentityPageTitle": "Verify your identity",
"@verifyIdentityPageTitle": {},
"verifyIdentityPageVerifyIdentityButtonLabel": "Verify Identity",
"@verifyIdentityPageVerifyIdentityButtonLabel": {},
"settingsPageColorSchemeSettingLabel": "Colors",
"colorSchemeOptionClassic": "Classic",
"colorSchemeOptionDynamic": "Dynamic",
"settingsPageColorSchemeSettingDialogDescription": "Choose between a classic color scheme inspired by a traditional Paperless green or use the dynamic color scheme based on your system theme.",
"settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": "Dynamic theming is only supported for devices running Android 12 and above. Selecting the 'Dynamic' option might not have any effect depending on your OS implementation.",
"documentSearchPageRemoveFromHistory": "Remove from search history?"
"@verifyIdentityPageVerifyIdentityButtonLabel": {}
}

View File

@@ -44,6 +44,10 @@
"@bottomNavLabelsPageLabel": {},
"bottomNavScannerPageLabel": "Tarayıcı",
"@bottomNavScannerPageLabel": {},
"colorSchemeOptionClassic": "Classic",
"@colorSchemeOptionClassic": {},
"colorSchemeOptionDynamic": "Dynamic",
"@colorSchemeOptionDynamic": {},
"correspondentFormFieldSearchHintText": "Yazmaya başlayın...",
"@correspondentFormFieldSearchHintText": {},
"deleteViewDialogContentText": "Bu görünümü gerçekten silmek istiyor musunuz?",
@@ -144,6 +148,12 @@
"@documentScannerPageUploadButtonTooltip": {},
"documentScannerPageUploadFromThisDeviceButtonLabel": "Bu cihazdan bir döküman yükleyin",
"@documentScannerPageUploadFromThisDeviceButtonLabel": {},
"documentSearchHistory": "History",
"@documentSearchHistory": {},
"documentSearchPageRemoveFromHistory": "Remove from search history?",
"@documentSearchPageRemoveFromHistory": {},
"documentSearchResults": "Results",
"@documentSearchResults": {},
"documentsEmptyStateResetFilterLabel": "Filtreyi sıfırla",
"@documentsEmptyStateResetFilterLabel": {},
"documentsFilterPageAdvancedLabel": "Gelişmiş",
@@ -570,6 +580,12 @@
"@settingsPageApplicationSettingsDescriptionText": {},
"settingsPageApplicationSettingsLabel": "Uygulama",
"@settingsPageApplicationSettingsLabel": {},
"settingsPageColorSchemeSettingDialogDescription": "Choose between a classic color scheme inspired by a traditional Paperless green or use the dynamic color scheme based on your system theme.",
"@settingsPageColorSchemeSettingDialogDescription": {},
"settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": "Dynamic theming is only supported for devices running Android 12 and above. Selecting the 'Dynamic' option might not have any effect depending on your OS implementation.",
"@settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": {},
"settingsPageColorSchemeSettingLabel": "Colors",
"@settingsPageColorSchemeSettingLabel": {},
"settingsPageLanguageSettingLabel": "Dil",
"@settingsPageLanguageSettingLabel": {},
"settingsPageSecuritySettingsDescriptionText": "Biyometrik kimlik doğrulama",
@@ -611,11 +627,5 @@
"verifyIdentityPageTitle": "Kimliğinizi doğrulayın",
"@verifyIdentityPageTitle": {},
"verifyIdentityPageVerifyIdentityButtonLabel": "Kimliği Doğrula",
"@verifyIdentityPageVerifyIdentityButtonLabel": {},
"settingsPageColorSchemeSettingLabel": "Colors",
"colorSchemeOptionClassic": "Classic",
"colorSchemeOptionDznamic": "Dynamic",
"settingsPageColorSchemeSettingDialogDescription": "Choose between the classic color scheme in Paperless inspired green or use the dynamic color scheme based on your system theme.",
"settingsPageColorSchemeSettingDynamicThemeingVersionMismatchWarning": "Dynamic theming is only supported for devices running Android 12 and above. Using the 'dynamic' option might not have any effect depending on your OS implementation.",
"documentSearchPageRemoveFromHistory": "Remove from search history?"
"@verifyIdentityPageVerifyIdentityButtonLabel": {}
}