feat: support smol:// QR sharing, deep links and in-dialog scanning
This commit is contained in:
parent
7d2a147fec
commit
aa74e12ee7
20 changed files with 591 additions and 101 deletions
|
|
@ -1,10 +1,25 @@
|
|||
import "package:auto_route/auto_route.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
|
||||
import "package:smol_mail/presentation/routes/home_guard.dart";
|
||||
import "package:smol_mail/presentation/routes/identity_guard.dart";
|
||||
import "app_router.gr.dart";
|
||||
|
||||
/// A DialogRoute is a PageRoute whose settings carry the AutoRoutePage, so
|
||||
/// auto_route's setNewRoutePath — which pops pageless top routes before
|
||||
/// resolving a platform link — leaves dialog pages standing.
|
||||
Route<T> dialogRouteBuilder<T>(
|
||||
BuildContext context,
|
||||
Widget child,
|
||||
AutoRoutePage<T> page,
|
||||
) =>
|
||||
DialogRoute<T>(
|
||||
context: context,
|
||||
settings: page,
|
||||
builder: (ctx) => child,
|
||||
);
|
||||
|
||||
@AutoRouterConfig(replaceInRouteName: "Screen,Route")
|
||||
class AppRouter extends RootStackRouter {
|
||||
final WidgetRef ref;
|
||||
|
|
@ -44,5 +59,11 @@ class AppRouter extends RootStackRouter {
|
|||
path: "/contact",
|
||||
guards: [IdentityGuard(ref)],
|
||||
),
|
||||
CustomRoute(
|
||||
page: ImportContactDialogRoute.page,
|
||||
path: "/import",
|
||||
customRouteBuilder: dialogRouteBuilder,
|
||||
guards: [IdentityGuard(ref)],
|
||||
),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue