mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 04:08:03 -06:00
chore: Update go_router configuration to use go_router_builder
This commit is contained in:
@@ -17,35 +17,11 @@ import 'package:paperless_mobile/routes/navigation_keys.dart';
|
||||
import 'package:paperless_mobile/routes/routes.dart';
|
||||
import 'package:paperless_mobile/theme.dart';
|
||||
|
||||
part 'documents_route.g.dart';
|
||||
|
||||
class DocumentsBranch extends StatefulShellBranchData {
|
||||
static final GlobalKey<NavigatorState> $navigatorKey = documentsNavigatorKey;
|
||||
const DocumentsBranch();
|
||||
}
|
||||
|
||||
@TypedGoRoute<DocumentsRoute>(
|
||||
path: "/documents",
|
||||
name: R.documents,
|
||||
routes: [
|
||||
TypedGoRoute<EditDocumentRoute>(
|
||||
path: "edit",
|
||||
name: R.editDocument,
|
||||
),
|
||||
TypedGoRoute<DocumentDetailsRoute>(
|
||||
path: "details",
|
||||
name: R.documentDetails,
|
||||
),
|
||||
TypedGoRoute<DocumentPreviewRoute>(
|
||||
path: "preview",
|
||||
name: R.documentPreview,
|
||||
),
|
||||
TypedGoRoute<BulkEditDocumentsRoute>(
|
||||
path: "bulk-edit",
|
||||
name: R.bulkEditDocuments,
|
||||
),
|
||||
],
|
||||
)
|
||||
class DocumentsRoute extends GoRouteData {
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:paperless_mobile/features/inbox/view/pages/inbox_page.dart';
|
||||
import 'package:paperless_mobile/routes/routes.dart';
|
||||
import 'package:paperless_mobile/routes/navigation_keys.dart';
|
||||
|
||||
part 'inbox_route.g.dart';
|
||||
class InboxBranch extends StatefulShellBranchData {
|
||||
static final GlobalKey<NavigatorState> $navigatorKey = inboxNavigatorKey;
|
||||
|
||||
const InboxBranch();
|
||||
}
|
||||
|
||||
@TypedGoRoute<InboxRoute>(
|
||||
path: "/inbox",
|
||||
name: R.inbox,
|
||||
)
|
||||
class InboxRoute extends GoRouteData {
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
|
||||
@@ -14,33 +14,12 @@ import 'package:paperless_mobile/features/labels/view/pages/labels_page.dart';
|
||||
import 'package:paperless_mobile/features/linked_documents/cubit/linked_documents_cubit.dart';
|
||||
import 'package:paperless_mobile/features/linked_documents/view/linked_documents_page.dart';
|
||||
import 'package:paperless_mobile/routes/navigation_keys.dart';
|
||||
import 'package:paperless_mobile/routes/routes.dart';
|
||||
|
||||
part 'labels_route.g.dart';
|
||||
|
||||
class LabelsBranch extends StatefulShellBranchData {
|
||||
static final GlobalKey<NavigatorState> $navigatorKey = labelsNavigatorKey;
|
||||
const LabelsBranch();
|
||||
}
|
||||
|
||||
@TypedGoRoute<LabelsRoute>(
|
||||
path: "/labels",
|
||||
name: R.labels,
|
||||
routes: [
|
||||
TypedGoRoute<EditLabelRoute>(
|
||||
path: "edit",
|
||||
name: R.editLabel,
|
||||
),
|
||||
TypedGoRoute<CreateLabelRoute>(
|
||||
path: "create",
|
||||
name: R.createLabel,
|
||||
),
|
||||
TypedGoRoute<LinkedDocumentsRoute>(
|
||||
path: "linked-documents",
|
||||
name: R.linkedDocuments,
|
||||
),
|
||||
],
|
||||
)
|
||||
class LabelsRoute extends GoRouteData {
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
|
||||
@@ -4,18 +4,12 @@ import 'package:paperless_mobile/features/landing/view/landing_page.dart';
|
||||
import 'package:paperless_mobile/routes/navigation_keys.dart';
|
||||
import 'package:paperless_mobile/routes/routes.dart';
|
||||
|
||||
part 'landing_route.g.dart';
|
||||
|
||||
class LandingBranch extends StatefulShellBranchData {
|
||||
static final GlobalKey<NavigatorState> $navigatorKey = landingNavigatorKey;
|
||||
|
||||
const LandingBranch();
|
||||
}
|
||||
|
||||
@TypedGoRoute<LandingRoute>(
|
||||
path: "/landing",
|
||||
name: R.landing,
|
||||
)
|
||||
class LandingRoute extends GoRouteData {
|
||||
const LandingRoute();
|
||||
@override
|
||||
|
||||
@@ -10,38 +10,12 @@ import 'package:paperless_mobile/features/document_upload/view/document_upload_p
|
||||
import 'package:paperless_mobile/routes/navigation_keys.dart';
|
||||
import 'package:paperless_mobile/routes/routes.dart';
|
||||
|
||||
part 'scanner_route.g.dart';
|
||||
|
||||
// @TypedStatefulShellBranch<ScannerBranch>(
|
||||
// routes: [
|
||||
// TypedGoRoute<ScannerRoute>(
|
||||
// path: "/scanner",
|
||||
// name: R.scanner,
|
||||
// routes: [
|
||||
// TypedGoRoute<DocumentUploadRoute>(
|
||||
// path: "upload",
|
||||
// name: R.uploadDocument,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
class ScannerBranch extends StatefulShellBranchData {
|
||||
static final GlobalKey<NavigatorState> $navigatorKey = scannerNavigatorKey;
|
||||
|
||||
const ScannerBranch();
|
||||
}
|
||||
|
||||
@TypedGoRoute<ScannerRoute>(
|
||||
path: "/scanner",
|
||||
name: R.scanner,
|
||||
routes: [
|
||||
TypedGoRoute<DocumentUploadRoute>(
|
||||
path: "upload",
|
||||
name: R.uploadDocument,
|
||||
),
|
||||
],
|
||||
)
|
||||
class ScannerRoute extends GoRouteData {
|
||||
const ScannerRoute();
|
||||
|
||||
|
||||
155
lib/routes/typed/shells/authenticated_route.dart
Normal file
155
lib/routes/typed/shells/authenticated_route.dart
Normal file
@@ -0,0 +1,155 @@
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/config/hive/hive_config.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/global_settings.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/local_user_account.dart';
|
||||
import 'package:paperless_mobile/core/factory/paperless_api_factory.dart';
|
||||
import 'package:paperless_mobile/features/home/view/home_shell_widget.dart';
|
||||
import 'package:paperless_mobile/features/home/view/scaffold_with_navigation_bar.dart';
|
||||
import 'package:paperless_mobile/features/sharing/cubit/receive_share_cubit.dart';
|
||||
import 'package:paperless_mobile/features/sharing/view/widgets/event_listener_shell.dart';
|
||||
import 'package:paperless_mobile/routes/navigation_keys.dart';
|
||||
import 'package:paperless_mobile/routes/routes.dart';
|
||||
import 'package:paperless_mobile/routes/typed/branches/documents_route.dart';
|
||||
import 'package:paperless_mobile/routes/typed/branches/inbox_route.dart';
|
||||
import 'package:paperless_mobile/routes/typed/branches/labels_route.dart';
|
||||
import 'package:paperless_mobile/routes/typed/branches/landing_route.dart';
|
||||
import 'package:paperless_mobile/routes/typed/branches/scanner_route.dart';
|
||||
import 'package:paperless_mobile/routes/typed/shells/scaffold_shell_route.dart';
|
||||
import 'package:paperless_mobile/routes/typed/top_level/settings_route.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
/// Key used to access
|
||||
|
||||
part 'authenticated_route.g.dart';
|
||||
|
||||
@TypedShellRoute<ProviderShellRoute>(
|
||||
routes: [
|
||||
TypedGoRoute<SettingsRoute>(
|
||||
path: "/settings",
|
||||
name: R.settings,
|
||||
),
|
||||
TypedStatefulShellRoute<ScaffoldShellRoute>(
|
||||
branches: [
|
||||
TypedStatefulShellBranch<LandingBranch>(
|
||||
routes: [
|
||||
TypedGoRoute<LandingRoute>(
|
||||
path: "/landing",
|
||||
name: R.landing,
|
||||
)
|
||||
],
|
||||
),
|
||||
TypedStatefulShellBranch<DocumentsBranch>(
|
||||
routes: [
|
||||
TypedGoRoute<DocumentsRoute>(
|
||||
path: "/documents",
|
||||
routes: [
|
||||
TypedGoRoute<DocumentDetailsRoute>(
|
||||
path: "details",
|
||||
name: R.documentDetails,
|
||||
),
|
||||
TypedGoRoute<EditDocumentRoute>(
|
||||
path: "edit",
|
||||
name: R.editDocument,
|
||||
),
|
||||
TypedGoRoute<BulkEditDocumentsRoute>(
|
||||
path: "bulk-edit",
|
||||
name: R.bulkEditDocuments,
|
||||
),
|
||||
TypedGoRoute<DocumentPreviewRoute>(
|
||||
path: 'preview',
|
||||
name: R.documentPreview,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
TypedStatefulShellBranch<ScannerBranch>(
|
||||
routes: [
|
||||
TypedGoRoute<ScannerRoute>(
|
||||
path: "/scanner",
|
||||
name: R.scanner,
|
||||
routes: [
|
||||
TypedGoRoute<DocumentUploadRoute>(
|
||||
path: "upload",
|
||||
name: R.uploadDocument,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
TypedStatefulShellBranch<LabelsBranch>(
|
||||
routes: [
|
||||
TypedGoRoute<LabelsRoute>(
|
||||
path: "/labels",
|
||||
name: R.labels,
|
||||
routes: [
|
||||
TypedGoRoute<EditLabelRoute>(
|
||||
path: "edit",
|
||||
name: R.editLabel,
|
||||
),
|
||||
TypedGoRoute<CreateLabelRoute>(
|
||||
path: "create",
|
||||
name: R.createLabel,
|
||||
),
|
||||
TypedGoRoute<LinkedDocumentsRoute>(
|
||||
path: "linked-documents",
|
||||
name: R.linkedDocuments,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
TypedStatefulShellBranch<InboxBranch>(
|
||||
routes: [
|
||||
TypedGoRoute<InboxRoute>(
|
||||
path: "/inbox",
|
||||
name: R.inbox,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
class ProviderShellRoute extends ShellRouteData {
|
||||
static final GlobalKey<NavigatorState> $navigatorKey = outerShellNavigatorKey;
|
||||
|
||||
const ProviderShellRoute();
|
||||
|
||||
@override
|
||||
Widget builder(
|
||||
BuildContext context,
|
||||
GoRouterState state,
|
||||
Widget navigator,
|
||||
) {
|
||||
final currentUserId = Hive.box<GlobalSettings>(HiveBoxes.globalSettings)
|
||||
.getValue()!
|
||||
.loggedInUserId;
|
||||
if (currentUserId == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final authenticatedUser =
|
||||
Hive.box<LocalUserAccount>(HiveBoxes.localUserAccount).get(
|
||||
currentUserId,
|
||||
)!;
|
||||
final apiFactory = context.read<PaperlessApiFactory>();
|
||||
return HomeShellWidget(
|
||||
localUserId: authenticatedUser.id,
|
||||
paperlessApiVersion: authenticatedUser.apiVersion,
|
||||
paperlessProviderFactory: apiFactory,
|
||||
child: ChangeNotifierProvider(
|
||||
create: (context) => ConsumptionChangeNotifier()
|
||||
..loadFromConsumptionDirectory(userId: currentUserId),
|
||||
child: EventListenerShell(
|
||||
child: navigator,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
import 'package:paperless_mobile/core/config/hive/hive_config.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/global_settings.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/local_user_account.dart';
|
||||
import 'package:paperless_mobile/core/factory/paperless_api_factory.dart';
|
||||
import 'package:paperless_mobile/features/home/view/home_shell_widget.dart';
|
||||
import 'package:paperless_mobile/features/sharing/cubit/receive_share_cubit.dart';
|
||||
import 'package:paperless_mobile/features/sharing/view/widgets/event_listener_shell.dart';
|
||||
import 'package:paperless_mobile/routes/navigation_keys.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
/// Key used to access
|
||||
|
||||
//part 'provider_shell_route.g.dart';
|
||||
//TODO: Wait for https://github.com/flutter/flutter/issues/127371 to be merged
|
||||
// @TypedShellRoute<ProviderShellRoute>(
|
||||
// routes: [
|
||||
// TypedStatefulShellRoute(
|
||||
// branches: [
|
||||
// TypedStatefulShellBranch<LandingBranch>(
|
||||
// routes: [
|
||||
// TypedGoRoute<LandingRoute>(
|
||||
// path: "/landing",
|
||||
// // name: R.landing,
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// TypedStatefulShellBranch<DocumentsBranch>(
|
||||
// routes: [
|
||||
// TypedGoRoute<DocumentsRoute>(
|
||||
// path: "/documents",
|
||||
// routes: [
|
||||
// TypedGoRoute<DocumentDetailsRoute>(
|
||||
// path: "details",
|
||||
// // name: R.documentDetails,
|
||||
// ),
|
||||
// TypedGoRoute<DocumentEditRoute>(
|
||||
// path: "edit",
|
||||
// // name: R.editDocument,
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
class ProviderShellRoute extends ShellRouteData {
|
||||
final PaperlessApiFactory apiFactory;
|
||||
static final GlobalKey<NavigatorState> $navigatorKey = outerShellNavigatorKey;
|
||||
|
||||
const ProviderShellRoute(this.apiFactory);
|
||||
|
||||
Widget build(
|
||||
BuildContext context,
|
||||
GoRouterState state,
|
||||
Widget navigator,
|
||||
) {
|
||||
final currentUserId = Hive.box<GlobalSettings>(HiveBoxes.globalSettings)
|
||||
.getValue()!
|
||||
.loggedInUserId;
|
||||
if (currentUserId == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final authenticatedUser =
|
||||
Hive.box<LocalUserAccount>(HiveBoxes.localUserAccount).get(
|
||||
currentUserId,
|
||||
)!;
|
||||
|
||||
return HomeShellWidget(
|
||||
localUserId: authenticatedUser.id,
|
||||
paperlessApiVersion: authenticatedUser.apiVersion,
|
||||
paperlessProviderFactory: apiFactory,
|
||||
child: ChangeNotifierProvider(
|
||||
create: (context) => ConsumptionChangeNotifier()
|
||||
..loadFromConsumptionDirectory(userId: currentUserId),
|
||||
child: EventListenerShell(child: navigator),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,12 @@ import 'package:paperless_mobile/features/home/view/scaffold_with_navigation_bar
|
||||
|
||||
class ScaffoldShellRoute extends StatefulShellRouteData {
|
||||
const ScaffoldShellRoute();
|
||||
|
||||
static Widget $navigatorContainerBuilder(BuildContext context,
|
||||
StatefulNavigationShell navigationShell, List<Widget> children) {
|
||||
return children[navigationShell.currentIndex];
|
||||
}
|
||||
|
||||
@override
|
||||
Widget builder(
|
||||
BuildContext context,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
@@ -23,58 +22,61 @@ class AddAccountRoute extends GoRouteData {
|
||||
const AddAccountRoute();
|
||||
|
||||
static final $parentNavigatorKey = rootNavigatorKey;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return AddAccountPage(
|
||||
titleText: S.of(context)!.addAccount,
|
||||
onSubmit:
|
||||
(context, username, password, serverUrl, clientCertificate) async {
|
||||
try {
|
||||
final userId = await context.read<AuthenticationCubit>().addAccount(
|
||||
credentials: LoginFormCredentials(
|
||||
username: username,
|
||||
password: password,
|
||||
),
|
||||
clientCertificate: clientCertificate,
|
||||
serverUrl: serverUrl,
|
||||
enableBiometricAuthentication: false,
|
||||
locale: Localizations.localeOf(context).languageCode,
|
||||
);
|
||||
final shoudSwitch = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => const SwitchAccountDialog(),
|
||||
) ??
|
||||
false;
|
||||
if (shoudSwitch) {
|
||||
await context.read<AuthenticationCubit>().switchAccount(userId);
|
||||
} else {
|
||||
while (context.canPop()) {
|
||||
context.pop();
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return NoTransitionPage(
|
||||
child: AddAccountPage(
|
||||
titleText: S.of(context)!.addAccount,
|
||||
onSubmit:
|
||||
(context, username, password, serverUrl, clientCertificate) async {
|
||||
try {
|
||||
final userId = await context.read<AuthenticationCubit>().addAccount(
|
||||
credentials: LoginFormCredentials(
|
||||
username: username,
|
||||
password: password,
|
||||
),
|
||||
clientCertificate: clientCertificate,
|
||||
serverUrl: serverUrl,
|
||||
enableBiometricAuthentication: false,
|
||||
locale: Localizations.localeOf(context).languageCode,
|
||||
);
|
||||
final shoudSwitch = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => const SwitchAccountDialog(),
|
||||
) ??
|
||||
false;
|
||||
if (shoudSwitch) {
|
||||
await context.read<AuthenticationCubit>().switchAccount(userId);
|
||||
} else {
|
||||
while (context.canPop()) {
|
||||
context.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
} on PaperlessApiException catch (error, stackTrace) {
|
||||
showErrorMessage(context, error, stackTrace);
|
||||
// context.pop();
|
||||
} on PaperlessFormValidationException catch (exception, stackTrace) {
|
||||
if (exception.hasUnspecificErrorMessage()) {
|
||||
showLocalizedError(context, exception.unspecificErrorMessage()!);
|
||||
} on PaperlessApiException catch (error, stackTrace) {
|
||||
showErrorMessage(context, error, stackTrace);
|
||||
// context.pop();
|
||||
} on PaperlessFormValidationException catch (exception, stackTrace) {
|
||||
if (exception.hasUnspecificErrorMessage()) {
|
||||
showLocalizedError(context, exception.unspecificErrorMessage()!);
|
||||
// context.pop();
|
||||
} else {
|
||||
showGenericError(
|
||||
context,
|
||||
exception.validationMessages.values.first,
|
||||
stackTrace,
|
||||
); //TODO: Check if we can show error message directly on field here.
|
||||
}
|
||||
} on InfoMessageException catch (error) {
|
||||
showInfoMessage(context, error);
|
||||
// context.pop();
|
||||
} catch (unknownError, stackTrace) {
|
||||
showGenericError(context, unknownError.toString(), stackTrace);
|
||||
// context.pop();
|
||||
} else {
|
||||
showGenericError(
|
||||
context,
|
||||
exception.validationMessages.values.first,
|
||||
stackTrace,
|
||||
); //TODO: Check if we can show error message directly on field here.
|
||||
}
|
||||
} on InfoMessageException catch (error) {
|
||||
showInfoMessage(context, error);
|
||||
// context.pop();
|
||||
} catch (unknownError, stackTrace) {
|
||||
showGenericError(context, unknownError.toString(), stackTrace);
|
||||
// context.pop();
|
||||
}
|
||||
},
|
||||
submitText: S.of(context)!.addAccount,
|
||||
},
|
||||
submitText: S.of(context)!.addAccount,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:paperless_mobile/routes/navigation_keys.dart';
|
||||
import 'package:paperless_mobile/routes/routes.dart';
|
||||
|
||||
part 'logging_out_route.g.dart';
|
||||
@@ -11,12 +10,16 @@ part 'logging_out_route.g.dart';
|
||||
name: R.loggingOut,
|
||||
)
|
||||
class LoggingOutRoute extends GoRouteData {
|
||||
static final $parentNavigatorKey = rootNavigatorKey;
|
||||
const LoggingOutRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Text("Logging out..."),
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return const NoTransitionPage(
|
||||
child: Scaffold(
|
||||
body: Center(
|
||||
child: Text("Logging out..."), //TODO: INTL
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import 'package:paperless_mobile/features/login/view/widgets/login_transition_pa
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
import 'package:paperless_mobile/routes/navigation_keys.dart';
|
||||
import 'package:paperless_mobile/routes/routes.dart';
|
||||
|
||||
part 'login_route.g.dart';
|
||||
|
||||
@TypedGoRoute<LoginRoute>(
|
||||
@@ -80,10 +79,13 @@ class SwitchingAccountsRoute extends GoRouteData {
|
||||
static final $parentNavigatorKey = rootNavigatorKey;
|
||||
|
||||
const SwitchingAccountsRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return LoginTransitionPage(
|
||||
text: S.of(context)!.switchingAccountsPleaseWait,
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return NoTransitionPage(
|
||||
child: LoginTransitionPage(
|
||||
text: S.of(context)!.switchingAccountsPleaseWait,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -93,8 +95,9 @@ class AuthenticatingRoute extends GoRouteData {
|
||||
|
||||
final String checkLoginStageName;
|
||||
const AuthenticatingRoute(this.checkLoginStageName);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
final stage = AuthenticatingStage.values.byName(checkLoginStageName);
|
||||
final text = switch (stage) {
|
||||
AuthenticatingStage.authenticating => S.of(context)!.authenticatingDots,
|
||||
@@ -103,8 +106,11 @@ class AuthenticatingRoute extends GoRouteData {
|
||||
AuthenticatingStage.fetchingUserInformation =>
|
||||
S.of(context)!.fetchingUserInformation,
|
||||
};
|
||||
|
||||
return LoginTransitionPage(text: text);
|
||||
return NoTransitionPage(
|
||||
child: LoginTransitionPage(
|
||||
text: text,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,8 +121,10 @@ class VerifyIdentityRoute extends GoRouteData {
|
||||
const VerifyIdentityRoute({required this.userId});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return VerifyIdentityPage(userId: userId);
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return NoTransitionPage(
|
||||
child: VerifyIdentityPage(userId: userId),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,8 +142,10 @@ class LoginToExistingAccountRoute extends GoRouteData {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const LoginToExistingAccountPage();
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return const NoTransitionPage(
|
||||
child: LoginToExistingAccountPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +155,11 @@ class RestoringSessionRoute extends GoRouteData {
|
||||
const RestoringSessionRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return LoginTransitionPage(text: S.of(context)!.restoringSession);
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return NoTransitionPage(
|
||||
child: LoginTransitionPage(
|
||||
text: S.of(context)!.restoringSession,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,9 @@ import 'package:paperless_mobile/routes/navigation_keys.dart';
|
||||
import 'package:paperless_mobile/routes/routes.dart';
|
||||
import 'package:paperless_mobile/theme.dart';
|
||||
|
||||
part 'settings_route.g.dart';
|
||||
|
||||
@TypedGoRoute<SettingsRoute>(
|
||||
path: "/settings",
|
||||
name: R.settings,
|
||||
)
|
||||
class SettingsRoute extends GoRouteData {
|
||||
static final GlobalKey<NavigatorState> $parentNavigatorKey = outerShellNavigatorKey;
|
||||
static final GlobalKey<NavigatorState> $parentNavigatorKey =
|
||||
outerShellNavigatorKey;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
|
||||
Reference in New Issue
Block a user