//抽屉菜单
leading: Builder(builder: (context){
return IconButton(
icon: Icon(Icons.dashboard,color:Colors.white),
onPressed: (){},
);
},),
//标题
title: Text(‘导航栏’),
//导航栏右侧菜单
actions: [
IconButton(
icon: Icon(Icons.share),
onPressed: (){},
)
],
),
),
);
}
}
在 Material
组件库中,提供了 TabBar
组件用于快速生成 Tab
菜单。在导航栏的底部通常是一组 Tab
菜单,可以通过上面 AppBar
的 bottom
属性来指定这组菜单。示例:
class _HomeContentState extends State with SingleTickerProviderStateMixin{
TabController _tabController;
List tabs = [“新闻”,“历史”,“图片”];
void initState(){
super.initState();
_tabController = TabController(length: tabs.length, vsync: this);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
//抽屉菜单
leading: Builder(builder: (context){
return IconButton(
icon: Icon(Icons.dashboard,color:Colors.white),
onPressed: (){},
);
},),
//标题
title: Text(‘导航栏’),
//导航栏右侧菜单
actions: [
IconButton(
icon: Icon(Icons.share),
onPressed: (){},
)