Skip to content

Commit ff9e93a

Browse files
committed
sliverbar sample updated
1 parent 9422b94 commit ff9e93a

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

lib/appbar_sliverappbar/sample2.dart

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ class Sample2 extends StatelessWidget {
44
@override
55
Widget build(BuildContext context) {
66
return SafeArea(
7-
child: Material(
8-
child: CustomScrollView(
7+
child: Scaffold(
8+
drawer: Drawer(),
9+
body: CustomScrollView(
910
slivers: [
1011
SliverPersistentHeader(
1112
delegate: MySliverAppBar(expandedHeight: 200),
@@ -14,8 +15,8 @@ class Sample2 extends StatelessWidget {
1415
SliverList(
1516
delegate: SliverChildBuilderDelegate(
1617
(_, index) => ListTile(
17-
title: Text("Index: $index"),
18-
),
18+
title: Text("Index: $index"),
19+
),
1920
),
2021
)
2122
],
@@ -31,8 +32,7 @@ class MySliverAppBar extends SliverPersistentHeaderDelegate {
3132
MySliverAppBar({@required this.expandedHeight});
3233

3334
@override
34-
Widget build(
35-
BuildContext context, double shrinkOffset, bool overlapsContent) {
35+
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
3636
return Stack(
3737
fit: StackFit.expand,
3838
overflow: Overflow.visible,
@@ -69,6 +69,18 @@ class MySliverAppBar extends SliverPersistentHeaderDelegate {
6969
),
7070
),
7171
),
72+
Align(
73+
alignment: Alignment.topLeft,
74+
child: IconButton(
75+
icon: Icon(
76+
Icons.menu,
77+
color: Colors.white,
78+
),
79+
onPressed: () {
80+
Scaffold.of(context).openDrawer();
81+
},
82+
),
83+
),
7284
],
7385
);
7486
}

0 commit comments

Comments
 (0)