Skip to content

Commit ffaeaf3

Browse files
committed
GFDrawerHeader completed
1 parent 5fbe2d5 commit ffaeaf3

4 files changed

Lines changed: 223 additions & 577 deletions

File tree

example/lib/main.dart

Lines changed: 49 additions & 30 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,40 @@ class _MyHomePageState extends State<MyHomePage> {
7879
child: ListView(
7980
padding: EdgeInsets.zero,
8081
children: <Widget>[
81-
UserAccountsDrawerHeader(),
82-
DrawerHeader(
82+
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,
87+
),
88+
decoration: BoxDecoration(
89+
color: Colors.teal.withOpacity(0.45),
90+
),
91+
onDetailsPressed: (){
92+
Navigator.pop(context);
93+
},
94+
otherAccountsPictures: <Widget>[
95+
Image(
96+
image: NetworkImage("https://cdn.pixabay.com/photo/2019/12/20/00/03/road-4707345_960_720.jpg"),
97+
fit: BoxFit.cover,
98+
),
99+
GFAvatar(
100+
child: Text("dcf"),
101+
)
102+
],
83103
child: Column(
104+
mainAxisAlignment: MainAxisAlignment.start,
105+
crossAxisAlignment: CrossAxisAlignment.start,
84106
children: <Widget>[
85-
Text('Drawer Header'),
86-
Text('Drawer Header'),
87-
Text('Drawer Header'),
107+
Text('user'),
108+
Text('user@asdf.com'),
88109
],
89110
),
90-
decoration: BoxDecoration(
91-
color: Colors.blue,
92-
),
93111
),
94112
ListTile(
95113
title: Text('Item 1'),
96114
onTap: () {
115+
Navigator.pop(context);
97116
},
98117
),
99118
ListTile(
@@ -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)