# flutter_appbar
封装一个简单的appbar,默认显示title和返回按钮和下面的分割线
- PreferredSizeWidget bottom 支持自定义bottom
- titleStyle 支持自定义title的风格
- backImgName 自定义返回按钮的图片
- backgroundColor 自定义导航栏颜色
核心代码:
Widget build(BuildContext context) {
return AppBar(
title: new Text(
widget.title ?? 'title',
style: new TextStyle(
color: Colors.black,
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
leading: widget.isShowBack ?
FlatButton(
child: Image(
image: new AssetImage('resources/base_navi_back@2x.png'),
width: 9,
height: 15,
),
onPressed: () {
Navigator.maybePop(context);
},
) : null,
backgroundColor: widget.backgroundColr ?? Colors.white,
elevation: 0,
bottom: new AppBarBottom(
child: widget.bottom,
),
actions: widget.actions,
);
}