Skip to content

Commit 82e866c

Browse files
committed
add the grid view.
1 parent f88bc9a commit 82e866c

File tree

2 files changed

+38
-22
lines changed

2 files changed

+38
-22
lines changed

lib/screen/ListScreen.dart

+15
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const USER_EMAILS = [
6060
6161
6262
];
63+
const GRID_VIEW = "Grid View";
6364

6465
class ListScreen extends StatefulWidget {
6566
ListScreen({Key key, this.group, this.onClick}) : super(key: key);
@@ -131,13 +132,27 @@ class _ListState extends State<ListScreen> {
131132
);
132133
}
133134

135+
Widget _topRight() {
136+
return InkWell(
137+
child: Container(
138+
child: Center(
139+
child: Text(
140+
GRID_VIEW,
141+
style: TextStyle(color: Colors.white),
142+
),
143+
),
144+
),
145+
);
146+
}
147+
134148
@override
135149
Widget build(BuildContext context) {
136150
return Scaffold(
137151
appBar: TopAppBar(
138152
group: widget.group,
139153
itemType: ItemType.list,
140154
onClick: widget.onClick,
155+
right: _topRight(),
141156
bottomView: PreferredSize(
142157
child: ListSelector(
143158
mainColor: Colors.white,

lib/view/app_bar.dart

+23-22
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,31 @@ const BAR_FONT_SIZE = 21.0;
1111
const BAR_TITLE_COLOR = Colors.white;
1212

1313
class TopAppBar extends AppBar {
14-
TopAppBar({
15-
GroupType group,
16-
ItemType itemType,
17-
PreferredSize bottomView,
18-
VoidCallback onClick,
19-
}) : super(
20-
leading: IconButton(
21-
icon: Icon(
22-
BAR_ICONS[group.index],
23-
color: BAR_TITLE_COLOR,
14+
TopAppBar(
15+
{GroupType group,
16+
ItemType itemType,
17+
PreferredSize bottomView,
18+
VoidCallback onClick,
19+
Widget right})
20+
: super(
21+
leading: IconButton(
22+
icon: Icon(
23+
BAR_ICONS[group.index],
24+
color: BAR_TITLE_COLOR,
25+
),
26+
onPressed: onClick,
2427
),
25-
onPressed: onClick,
26-
),
27-
title: Text(
28-
BOTTOM_TITLES[itemType.index],
29-
style: TextStyle(
30-
color: BAR_TITLE_COLOR,
31-
fontSize: BAR_FONT_SIZE,
28+
title: Text(
29+
BOTTOM_TITLES[itemType.index],
30+
style: TextStyle(
31+
color: BAR_TITLE_COLOR,
32+
fontSize: BAR_FONT_SIZE,
33+
),
3234
),
33-
),
34-
bottom: bottomView,
35-
backgroundColor: BAR_BACK_COLORS[group.index],
36-
elevation: 0.0,
37-
);
35+
bottom: bottomView,
36+
backgroundColor: BAR_BACK_COLORS[group.index],
37+
elevation: 0.0,
38+
actions: right == null ? null : [right]);
3839
}
3940

4041
class SliverBar extends SliverAppBar {

0 commit comments

Comments
 (0)