Skip to content

Commit 8c626ba

Browse files
authored
Merge pull request #22 from deepikahr/drawer
Drawer
2 parents b249d3b + d54860f commit 8c626ba

File tree

4 files changed

+207
-578
lines changed

4 files changed

+207
-578
lines changed

example/lib/main.dart

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import 'package:ui_kit/position/gf_position.dart';
2121
import 'package:ui_kit/components/tabs/gf_tabs.dart';
2222
import 'package:ui_kit/components/slider/gf_items_slider.dart';
2323
import 'package:ui_kit/components/drawer/gf_drawer.dart';
24+
import 'package:ui_kit/components/drawer/gf_drawer_header.dart';
2425

2526
final List<String> imageList = [
2627
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg",
@@ -63,7 +64,7 @@ class _MyHomePageState extends State<MyHomePage> {
6364
return Scaffold(
6465
drawer: GFDrawer(
6566
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.6), BlendMode.darken),
66-
// backgroundImage: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
67+
backgroundImage: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
6768
gradient: LinearGradient(
6869
begin: Alignment.topRight,
6970
end: Alignment.bottomLeft,
@@ -78,22 +79,37 @@ class _MyHomePageState extends State<MyHomePage> {
7879
child: ListView(
7980
padding: EdgeInsets.zero,
8081
children: <Widget>[
81-
UserAccountsDrawerHeader(),
82-
DrawerHeader(
82+
GFDrawerHeader(
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"),
86+
),
87+
88+
decoration: BoxDecoration(
89+
color: Colors.teal.withOpacity(0.45),
90+
),
91+
otherAccountsPictures: <Widget>[
92+
Image(
93+
image: NetworkImage("https://cdn.pixabay.com/photo/2019/12/20/00/03/road-4707345_960_720.jpg"),
94+
fit: BoxFit.cover,
95+
),
96+
GFAvatar(
97+
child: Text("dcf"),
98+
)
99+
],
83100
child: Column(
101+
mainAxisAlignment: MainAxisAlignment.start,
102+
crossAxisAlignment: CrossAxisAlignment.start,
84103
children: <Widget>[
85-
Text('Drawer Header'),
86-
Text('Drawer Header'),
87-
Text('Drawer Header'),
104+
Text('user'),
105+
88106
],
89107
),
90-
decoration: BoxDecoration(
91-
color: Colors.blue,
92-
),
93108
),
94109
ListTile(
95110
title: Text('Item 1'),
96111
onTap: () {
112+
Navigator.pop(context);
97113
},
98114
),
99115
ListTile(
@@ -107,13 +123,16 @@ class _MyHomePageState extends State<MyHomePage> {
107123
backgroundColor: Colors.cyanAccent,
108124
appBar: AppBar(
109125
title: Text(widget.title),
110-
111126
),
112127
body: SingleChildScrollView(
113128
child: Column(
114129
mainAxisAlignment: MainAxisAlignment.center,
115130
crossAxisAlignment: CrossAxisAlignment.center,
116131
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+
),
117136

118137
// GFItemsSlider(
119138
// rowCount: 3,
@@ -167,7 +186,7 @@ class _MyHomePageState extends State<MyHomePage> {
167186
// ),
168187

169188
GFButton(
170-
color: Colors.green,
189+
// color: Colors.green,
171190
onPressed: null,
172191
child: Text("share"),
173192
type: GFType.outline,
@@ -482,26 +501,26 @@ class _MyHomePageState extends State<MyHomePage> {
482501
//// borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid),
483502
//// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero),
484503
// ),
485-
// GFButtonBadge(
486-
// onPressed: null,
487-
//// position: GFIconPosition.start,
488-
//// borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid),
489-
//// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero),
490-
// text: 'goodies',
491-
//// color: GFColor.danger,
492-
//// shape: GFButtonShape.pills,
493-
//// type: GFType.outline,
494-
//// size: GFSize.small,
495-
// counterChild: GFBadge(
496-
// child: Text("12"),
497-
//// color: GFColor.dark,
498-
// shape: GFBadgeShape.circle,
499-
//// size: GFSize.small,
500-
//// border: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid),
501-
//// textColor: GFColor.white,
502-
//// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0),
503-
// ),
504-
// ),
504+
GFButtonBadge(
505+
onPressed: null,
506+
// position: GFIconPosition.start,
507+
// borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid),
508+
// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero),
509+
text: 'goodies',
510+
// color: GFColor.danger,
511+
// shape: GFButtonShape.pills,
512+
type: GFType.outline,
513+
// size: GFSize.small,
514+
counterChild: GFBadge(
515+
child: Text("12"),
516+
// color: GFColor.dark,
517+
shape: GFBadgeShape.circle,
518+
// size: GFSize.small,
519+
// border: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid),
520+
// textColor: GFColor.white,
521+
// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0),
522+
),
523+
),
505524
// GFBadge(
506525
// text: '12',
507526
//// color: GFColor.dark,

lib/components/badge/gf_button_badge.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class GFButtonBadge extends StatefulWidget {
6060
this.type = GFType.solid,
6161
this.shape = GFButtonShape.standard,
6262
this.color = GFColor.primary,
63-
this.textColor = GFColor.dark,
63+
this.textColor,
6464
this.position = GFPosition.end,
6565
this.size = GFSize.medium,
6666
this.borderSide,
@@ -88,7 +88,7 @@ class _GFButtonBadgeState extends State<GFButtonBadge> {
8888
@override
8989
void initState() {
9090
this.color = getGFColor(widget.color);
91-
this.textColor = getGFColor(widget.textColor);
91+
this.textColor = widget.type == GFType.outline && widget.textColor == null ? this.color : widget.textColor == null ? getGFColor(GFColor.dark) : getGFColor(widget.textColor);
9292
this.onPressed = widget.onPressed;
9393
this.type = widget.type;
9494
this.shape = widget.shape;

0 commit comments

Comments
 (0)