try fix platformview overlap

This commit is contained in:
Fabian Freund
2026-02-02 23:33:21 +01:00
parent 4765381ada
commit 142c260fee
6 changed files with 260 additions and 56 deletions
+23
View File
@@ -52,3 +52,26 @@ Future<GoRouter> router(Ref ref) async {
initialLocation: initialLocation ?? const BrowserRoute().location,
);
}
@Riverpod(keepAlive: true)
class CurrentTopRoute extends _$CurrentTopRoute {
@override
RouteBase? build() {
final router = ref.watch(routerProvider).value;
if (router == null) return null;
void update() {
final config = router.routerDelegate.currentConfiguration;
final match = config.last;
state = match.route;
}
router.routerDelegate.addListener(update);
ref.onDispose(() => router.routerDelegate.removeListener(update));
update();
return state;
}
}