Line data Source code
1 : part of '../main.dart'; 2 : 3 : @immutable 4 : class VPage extends VRouteElementWithPage { 5 : final Page Function(Widget child) pageBuilder; 6 : 7 12 : VPage({ 8 : required String? path, 9 : required this.pageBuilder, 10 : required Widget widget, 11 : String? name, 12 : List<VRouteElement> stackedRoutes = const [], 13 : List<String> aliases = const [], 14 : bool mustMatchSubRoute = false, 15 12 : }) : super( 16 : widget: widget, 17 : path: path, 18 : name: name, 19 : stackedRoutes: stackedRoutes, 20 : aliases: aliases, 21 : mustMatchSubRoute: mustMatchSubRoute, 22 : ); 23 : 24 10 : @override 25 : Page buildPage({ 26 : required Widget widget, 27 : required VPathRequestData vPathRequestData, 28 : required pathParameters, 29 : required VRouteElementNode vRouteElementNode, 30 : }) => 31 20 : pageBuilder( 32 10 : LocalVRouterData( 33 10 : child: NotificationListener<VNavigationGuardMessage>( 34 : // This listen to [VNavigationGuardNotification] which is a notification 35 : // that a [VNavigationGuard] sends when it is created 36 : // When this happens, we store the VNavigationGuard and its context 37 : // This will be used to call its afterUpdate and beforeLeave in particular. 38 0 : onNotification: (VNavigationGuardMessage vNavigationGuardMessage) { 39 0 : VNavigationGuardMessageRoot( 40 0 : vNavigationGuard: vNavigationGuardMessage.vNavigationGuard, 41 0 : localContext: vNavigationGuardMessage.localContext, 42 : associatedVRouteElement: this, 43 0 : ).dispatch(vPathRequestData.rootVRouterContext); 44 : 45 : return true; 46 : }, 47 : child: widget, 48 : ), 49 : vRouteElementNode: vRouteElementNode, 50 10 : url: vPathRequestData.url, 51 10 : previousUrl: vPathRequestData.previousUrl, 52 10 : historyState: vPathRequestData.historyState, 53 : pathParameters: pathParameters, 54 10 : queryParameters: vPathRequestData.queryParameters, 55 10 : context: vPathRequestData.rootVRouterContext, 56 : ), 57 : ); 58 : }