Skip to content

Commit d54860f

Browse files
committed
GFDrawer completed
1 parent ffaeaf3 commit d54860f

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

example/lib/main.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,14 @@ class _MyHomePageState extends State<MyHomePage> {
8080
padding: EdgeInsets.zero,
8181
children: <Widget>[
8282
GFDrawerHeader(
83-
arrowColor: Colors.tealAccent,
84-
currentAccountPicture: Image(
85-
image: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
86-
fit: BoxFit.cover,
83+
currentAccountPicture: GFAvatar(
84+
radius: 80.0,
85+
backgroundImage: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
8786
),
87+
8888
decoration: BoxDecoration(
8989
color: Colors.teal.withOpacity(0.45),
9090
),
91-
onDetailsPressed: (){
92-
Navigator.pop(context);
93-
},
9491
otherAccountsPictures: <Widget>[
9592
Image(
9693
image: NetworkImage("https://cdn.pixabay.com/photo/2019/12/20/00/03/road-4707345_960_720.jpg"),
@@ -126,13 +123,16 @@ class _MyHomePageState extends State<MyHomePage> {
126123
backgroundColor: Colors.cyanAccent,
127124
appBar: AppBar(
128125
title: Text(widget.title),
129-
130126
),
131127
body: SingleChildScrollView(
132128
child: Column(
133129
mainAxisAlignment: MainAxisAlignment.center,
134130
crossAxisAlignment: CrossAxisAlignment.center,
135131
children: <Widget>[
132+
GFAvatar(
133+
radius: 80.0,
134+
backgroundImage: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
135+
),
136136

137137
// GFItemsSlider(
138138
// rowCount: 3,

lib/components/drawer/gf_drawer_header.dart

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ class GFDrawerHeader extends StatefulWidget {
7171
this.margin = const EdgeInsets.only(bottom: 8.0),
7272
this.currentAccountPicture,
7373
this.otherAccountsPictures,
74-
this.onDetailsPressed,
75-
this.arrowColor = Colors.white,
7674
this.child,
7775
this.duration = const Duration(milliseconds: 250),
7876
this.curve = Curves.fastOutSlowIn,
@@ -94,13 +92,6 @@ class GFDrawerHeader extends StatefulWidget {
9492
/// upper-right corner. Normally a list of [CircleAvatar] widgets.
9593
final List<Widget> otherAccountsPictures;
9694

97-
/// A callback that is called when the horizontal area which contains the
98-
/// [accountName] and [accountEmail] is tapped.
99-
final VoidCallback onDetailsPressed;
100-
101-
/// The [Color] of the arrow icon.
102-
final Color arrowColor;
103-
10495
/// A widget to be placed inside the drawer header, inset by the [padding].
10596
///
10697
/// This widget will be sized to the size of the header. To position the child
@@ -120,14 +111,6 @@ class GFDrawerHeader extends StatefulWidget {
120111
}
121112

122113
class _GFDrawerHeaderState extends State<GFDrawerHeader> {
123-
bool _isOpen = false;
124-
125-
void _handleDetailsPressed() {
126-
setState(() {
127-
_isOpen = !_isOpen;
128-
});
129-
widget.onDetailsPressed();
130-
}
131114

132115
@override
133116
Widget build(BuildContext context) {

0 commit comments

Comments
 (0)