Flutter 颤振侧导航栏小部件

Flutter 颤振侧导航栏小部件,flutter,dart,material-design,Flutter,Dart,Material Design,如何在颤振中实现此侧导航栏(左)?如果我没有错的话,这里有一个小部件,但是我在任何地方都找不到这个名字 您正在搜索的小部件被调用。 它也有很好的文档记录 示例用法如下所示: int\u选择的索引=0; @凌驾 小部件构建(构建上下文){ 返回脚手架( 正文:世界其他地区( 儿童:[ 导航轨道( selectedIndex:\u selectedIndex, onDestinationSelected:(int索引){ 设置状态(){ _selectedIndex=索引; }); }, label


如何在颤振中实现此侧导航栏(左)?如果我没有错的话,这里有一个小部件,但是我在任何地方都找不到这个名字

您正在搜索的小部件被调用。
它也有很好的文档记录

示例用法如下所示:

int\u选择的索引=0;
@凌驾
小部件构建(构建上下文){
返回脚手架(
正文:世界其他地区(
儿童:[
导航轨道(
selectedIndex:\u selectedIndex,
onDestinationSelected:(int索引){
设置状态(){
_selectedIndex=索引;
});
},
labelType:NavigationRailLabelType.selected,
目的地:[
导航铁路目的地(
图标:图标(图标。收藏夹边框),
选择图标:图标(Icons.favorite),
标签:文本('First'),
),
导航铁路目的地(
图标:图标(图标、书签和边框),
选择图标:图标(Icons.book),
标签:文本('Second'),
),
导航铁路目的地(
图标:图标(图标。星形边框),
选择图标:图标(Icons.star),
标签:文本('Third'),
),
],
),
垂直分隔带(厚度:1,宽度:1),
//这是主要内容。
扩大(
儿童:中心(
子项:文本('selectedIndex:$\u selectedIndex'),
),
)
],
),
);
}

这称为
导航导轨
。你可以找到更多

用法:

child:NavigationRail(
  selectedIndex:_currentIndex,
  onDestinationSelected: (int index) {
    setState(() {
      // Change Index When Widget is Selected.
      _currentIndex = index;
    });
  destinations:[
    // You Navigation Rail Items/Destinations
    NavigationRailDestination(
      icon: Icon(Icons.favorite_border),
      selectedIcon: Icon(Icons.favorite),
      label: Text('Home'),
    ),
  ]
  },

非常感谢你。我完全忘记了这个名字。谢谢你的使用案例。非常感谢。也谢谢你的例子。