AppBar({
Key key,
this.leading, //导航栏最左侧Widget,常见为抽屉菜单按钮或返回按钮。
this.automaticallyImplyLeading = true, //如果leading为null,是否自动实现默认的leading按钮
this.title,// 页面标题
this.actions, // 导航栏右侧菜单
this.bottom, // 导航栏底部菜单,通常为Tab按钮组
this.elevation = 4.0, // 导航栏阴影
this.centerTitle, //标题是否居中
this.backgroundColor,
… //其它属性见源码注释
})
示例:
class App extends StatelessWidget{
@override
Widget build(BuildContext context) {
return MaterialApp(
home: 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),