AppBar显示在App的顶部,AppBar结构如图所示:
AppBar属性如表所示:
左侧为返回按钮,title是“Flutter实战入门”,右侧有3个图标,代码如下:
Scaffold(
appBar: AppBar(
leading: IconButton(icon: Icon(Icons.arrow_back), onPressed: () {}),
title: Text('Flutter 实战入门'),
actions: <Widget>[
IconButton(icon: Icon(Icons.add), onPressed: () {}),
IconButton(icon: Icon(Icons.dashboard), onPressed: () {}),
IconButton(icon: Icon(Icons.cached), onPressed: () {}),
],
),
)
运行效果如图所示:
酷客网相关文章:
评论前必须登录!
注册