Flutter 如何使用Navigator 2中的嵌套导航器制作双面板布局?

Flutter 如何使用Navigator 2中的嵌套导航器制作双面板布局?,flutter,flutter-navigation,Flutter,Flutter Navigation,我一直很难弄清楚如何使用Navigator 2处理颤振中的两个面板。我设法在一个根导航器中安装了两个导航器,其中包含一行,负责URL处理。但是,“浏览器后退”按钮不起作用。当我按下它时,什么也听不见,什么也没变。我想在“/”回家。有人知道如何解决这个问题吗?其他一切正常,appbar后退按钮正常,只是浏览器坏了 类ColorStudioApp2扩展StatefulWidget{ @凌驾 State createState()=>\u ColorStudioApp2State(); } 类_Co

我一直很难弄清楚如何使用Navigator 2处理颤振中的两个面板。我设法在一个根导航器中安装了两个导航器,其中包含一行,负责URL处理。但是,“浏览器后退”按钮不起作用。当我按下它时,什么也听不见,什么也没变。我想在“/”回家。有人知道如何解决这个问题吗?其他一切正常,appbar后退按钮正常,只是浏览器坏了

类ColorStudioApp2扩展StatefulWidget{ @凌驾 State createState()=>\u ColorStudioApp2State(); } 类_ColorStudioApp2State扩展状态{ 最终ColorRouterDelegate _routerDelegate=ColorRouterDelegate(); 最终ColorRouteInformationParser_routeInformationParser= ColorRouteInformation解析器(); @凌驾 小部件构建(构建上下文){ 返回材料PP.router( 标题:“色彩工作室”, routerDelegate:_routerDelegate, routeInformationParser:_routeInformationParser, ); } } 类ColorRouteInformation解析器 扩展路由信息解析器{ @凌驾 未来路由信息( 路由信息(路由信息)异步{ 最终uri=uri.parse(routeInformation.location); if(uri.pathSegments.length==1){ if(uri.pathSegments[0]=“多色”) 返回ColorRoutePath.to(屏幕面板多色); if(uri.pathSegments[0]=“singleColor”) 返回ColorRoutePath.to(ScreenPanel.singleColor); } 返回ColorRoutePath.home(); } @凌驾 路由信息恢复器输出信息(彩色路由路径路径){ 打印(“恢复输出信息路径为${path.panel}”); if(path.isHomePage){ 返回路线信息(位置:“/”); } if(path.isMultiColorPage){ 返回路由信息(位置:'/multiColor'); } if(path.isSingleColorPage){ 返回路由信息(位置:'/singleColor'); } 返回null; } } 类ColorRouterDelegate扩展了RouterDelegate 使用ChangeNotifier、PopNavigatorRouterDelegateMixin{ ColorRouterDelegate():navigatorKey=GlobalKey(); @凌驾 最后的环球航行; ScreenPanel selectedScreen=ScreenPanel.home; @凌驾 ColorRoutePath获取当前配置{ 将ColorRoutePath.返回(selectedScreen); } @凌驾 小部件构建(构建上下文){ 返回导航器( 关键:导航工作, 页码:[ 材料页( 键:ValueKey(“两个面板”), 孩子:排( 儿童:[ 扩大( 孩子:领航员( 页码:[ 材料页( key:ValueKey(“方案/对比/盲”), 孩子:脚手架( 正文:中( 儿童:升降按钮( 子项:文本(“下一页1”), 按下按钮:_handleMultiColor, ), ), ), ), 如果(selectedScreen==ScreenPanel.multiColor) 材料页( key:ValueKey(“多色比较”), 孩子:脚手架( appBar:appBar(), 正文:中( 子项:文本(“第2页”), ), ), ), ], onPopPage:(路线、动态结果){ 打印(“POP1”); 如果(!route.didPop(结果)){ 返回false; } selectedScreen=ScreenPanel.home; notifyListeners(); 返回true; }, ), ), 扩大( 孩子:领航员( 页码:[ 材料页( key:ValueKey(“方案/对比/盲”), 孩子:脚手架( 正文:中( 儿童:升降按钮( 子项:文本(“下一页2”), 按下按钮:_handleSingleColor, ), ), ), ), 如果(selectedScreen==ScreenPanel.singleColor) 材料页( key:ValueKey(“多色比较”), 孩子:脚手架( appBar:appBar(), 正文:中( 子项:文本(“第3页”), ), ), ), ], onPopPage:(路线、动态结果){ 印刷品(“POP 2”); 如果(!route.didPop(结果)){ 返回false; } selectedScreen=ScreenPanel.home; notifyListeners(); 返回true; }, ), ), ], ), ), ], onPopPage:(路线、动态结果){ 打印(“POP2”); 如果(!route.didPop(结果)){ 返回false; } selectedScreen=ScreenPanel.home; notifyListeners(); 返回true; }, ); } @凌驾 Future setNewRoutePath(ColorRoutePath路径)异步{ 打印(“setNewRoutePath为${path.panel}”); selectedScreen=path.panel; 返回; } void _handleMultiColor(){ selectedScreen=ScreenPanel.multiColor; notifyListeners(); } void_handleSingleColor(){ selectedScreen=ScreenPanel.singleColor; notifyListeners(); } } enu