openRoute static method
Opens host modally on navigator as a transparent full-screen route.
The route is transparent so touches pass through until the skin is
ready; back always closes. Returns false when busy. Never throws.
Implementation
static Future<bool> openRoute({
required NavigatorState navigator,
required GameWebViewHost host,
Object? routeKey,
}) async {
if (_busy) {
_log.w('Game not opened — another game is already open');
return false;
}
_busy = true;
try {
final route = PageRouteBuilder<void>(
settings: routeKey == null ? null : RouteSettings(arguments: routeKey),
opaque: false,
barrierDismissible: false,
barrierColor: const Color(0x00000000),
transitionDuration: const Duration(milliseconds: 250),
reverseTransitionDuration: const Duration(milliseconds: 200),
pageBuilder: (context, _, __) => host,
);
final pushed = navigator.push(route);
// The route's overlay entries exist once pushed: the host slips the
// floaters under them so they show through the transparent game.
activeRoute.value = route;
await pushed;
} catch (error) {
_log.w('Game not opened — route push failed ($error)');
} finally {
activeRoute.value = null;
_busy = false;
}
return true;
}