Skip to content

Commit 509d914

Browse files
committed
feat: add appbar‘
1 parent c1a221a commit 509d914

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed
Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1-
## **AppBar**
1+
## **AppBar**
2+
> 创建导航栏,
3+
4+
### 构造函数
5+
```
6+
AppBar({
7+
Key key,
8+
Widget leading,
9+
bool automaticallyImplyLeading: true,
10+
Widget title,
11+
List<Widget> actions,
12+
Widget flexibleSpace,
13+
PreferredSizeWidget bottom,
14+
double elevation,
15+
Color backgroundColor,
16+
Brightness brightness,
17+
IconThemeData iconTheme,
18+
TextTheme textTheme,
19+
bool primary: true,
20+
bool centerTitle,
21+
double titleSpacing: NavigationToolbar.kMiddleSpacing,
22+
double toolbarOpacity: 1.0,
23+
double bottomOpacity: 1.0
24+
})
25+
```
26+
27+
### 属性介绍
28+
- leading: 导航栏左侧图标
29+
- title: 导航栏标题
30+
- actions: 导航栏右侧扩展图标,可添加PopupMenuButton,点开有下拉展开更多按钮。
31+
- automaticallyImplyLeading: 默认true, 当有上一级页面时,默认显示back按钮
32+
- bottom: 通过与Tabbar使用

lib/widget/navigator/appbar/demo.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class _IndexState extends State<Index> {
1919
Widget build(BuildContext context) {
2020
return Scaffold(
2121
appBar: AppBar(
22-
title: Text('My Fancy Dress'),
22+
title: Text('AppBar'),
2323
actions: <Widget>[
2424
IconButton(
2525
icon: Icon(Icons.playlist_play),
@@ -37,7 +37,10 @@ class _IndexState extends State<Index> {
3737
onPressed: _repairDress,
3838
),
3939
],
40-
)
40+
),
41+
body: Center(
42+
child: Image.network('https://flutter.github.io/assets-for-api-docs/assets/material/app_bar.png', fit: BoxFit.contain,),
43+
),
4144
);
4245
}
4346
}

0 commit comments

Comments
 (0)