首页 > 解决方案 > Flutter (Web) - 使用带有导航栏的路由

问题描述

是否可以在不加载小部件的情况下在 url (flutter web) 中推送名称?

喜欢 :

return MaterialApp(
      title: 'mytitle',
      initialRoute: '/home',
      routes: {
        '/home': (context) => SafeArea(child: NavigationRailBar(initialIndex: 0)),
        '/item1': // don't do anything but bind a destination with a url on click of the navigationrail
        '/item2' : //
        '/item3': //
      
      },

因为 NavigationRail 已经将您送到正确的“目的地”

标签: flutterdartroutesflutter-web

解决方案


推荐阅读