Skip to content

Commit f550d5d

Browse files
Merge pull request #19 from ionicfirebaseapp/master
master pull
2 parents 00f6b77 + 4acba72 commit f550d5d

File tree

5 files changed

+96
-72
lines changed

5 files changed

+96
-72
lines changed

example/lib/main.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter/widgets.dart';
23
import 'package:getflutter/getflutter.dart';
34

45
final List<String> imageList = [
@@ -100,7 +101,7 @@ class _MyHomePageState extends State<MyHomePage>
100101
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
101102
),
102103
decoration: BoxDecoration(
103-
color: Colors.transparent,
104+
color: Colors.teal,
104105
),
105106
otherAccountsPictures: <Widget>[
106107
Image(
@@ -112,6 +113,7 @@ class _MyHomePageState extends State<MyHomePage>
112113
child: Text("dcf"),
113114
)
114115
],
116+
// closeButton: Text("Close"),
115117
child: Column(
116118
mainAxisAlignment: MainAxisAlignment.start,
117119
crossAxisAlignment: CrossAxisAlignment.start,
@@ -174,6 +176,7 @@ class _MyHomePageState extends State<MyHomePage>
174176
// Container(color: Colors.green),
175177
// Container(color: Colors.blue)
176178
// ]),
179+
177180
SingleChildScrollView(
178181
child: Column(
179182
mainAxisAlignment: MainAxisAlignment.center,
@@ -645,6 +648,7 @@ class _MyHomePageState extends State<MyHomePage>
645648
// ),
646649
//
647650
GFButton(
651+
// position: GFPosition.end,
648652
// icon: GFBadge(
649653
// child: Text("12"),
650654
// color: GFColor.dark,
@@ -661,9 +665,9 @@ class _MyHomePageState extends State<MyHomePage>
661665
// hoverColor: GFColor.dark,
662666
color: GFColor.secondary,
663667
// focusColor: GFColor.danger,
664-
type: GFButtonType.solid,
665-
shape: GFButtonShape.pills,
666-
buttonBoxShadow: true,
668+
// type: GFButtonType.solid,
669+
// shape: GFButtonShape.pills,
670+
// buttonBoxShadow: true,
667671
// boxShadow: BoxShadow(
668672
// color: Colors.pink,
669673
// blurRadius: 2.0,
@@ -675,7 +679,7 @@ class _MyHomePageState extends State<MyHomePage>
675679
// size: GFSize.large,
676680
// disabledColor: GFColor.dark,
677681
// disabledTextColor: GFColor.light,
678-
blockButton: true,
682+
// blockButton: true,
679683
// fullWidthButton: true,
680684
// borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid),
681685
// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero),

lib/components/accordian/gf_accordian.dart

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ class GFAccordion extends StatefulWidget {
66
{Key key,
77
this.child,
88
this.content,
9-
this.titlebackgroundColor,
9+
this.collapsedTitlebackgroundColor = Colors.white,
10+
this.expandedTitlebackgroundColor= const Color(0xFFE0E0E0),
1011
this.collapsedIcon = const Icon(Icons.keyboard_arrow_down),
1112
this.expandedIcon = const Icon(Icons.keyboard_arrow_up),
1213
this.title,
1314
this.textStyle = const TextStyle(color: Colors.black, fontSize: 16),
14-
this.titlePadding,
15+
this.titlePadding = const EdgeInsets.all(10),
1516
this.contentbackgroundColor,
16-
this.contentPadding,
17+
this.contentPadding = const EdgeInsets.all(10),
1718
this.contentChild,
18-
this.titleborderColor,
19-
this.contentBorderColor,
19+
this.titleborderColor = const Border(),
20+
this.contentBorderColor = const Border(),
2021
this.margin})
2122
: super(key: key);
2223

@@ -29,8 +30,11 @@ class GFAccordion extends StatefulWidget {
2930
/// contentChild of type [Widget]is alternative to content key. content will get priority over contentChild
3031
final Widget contentChild;
3132

32-
/// type of [Color] or [GFColor] which is used to change the background color of the [GFAccordion] title
33-
final dynamic titlebackgroundColor;
33+
/// type of [Color] or [GFColor] which is used to change the background color of the [GFAccordion] title when it is collapsed
34+
final dynamic collapsedTitlebackgroundColor;
35+
36+
/// type of [Color] or [GFColor] which is used to change the background color of the [GFAccordion] title when it is expanded
37+
final dynamic expandedTitlebackgroundColor;
3438

3539
///collapsedIcon of type [Widget] which is used to show when the [GFAccordion] is collapsed
3640
final Widget collapsedIcon;
@@ -86,6 +90,11 @@ class _GFAccordionState extends State<GFAccordion>
8690
),
8791
);
8892
}
93+
@override
94+
void dispose() {
95+
animationController.dispose();
96+
super.dispose();
97+
}
8998

9099
bool showAccordion = false;
91100

@@ -113,21 +122,10 @@ class _GFAccordionState extends State<GFAccordion>
113122
},
114123
child: Container(
115124
decoration: BoxDecoration(
116-
border: widget.titleborderColor == null
117-
? widget.titleborderColor
118-
: Border(
119-
top: BorderSide(color: Colors.black38),
120-
left: BorderSide(color: Colors.black38),
121-
right: BorderSide(color: Colors.black38),
122-
bottom: BorderSide(color: Colors.black38)),
123-
color: showAccordion
124-
? widget.titlebackgroundColor != null
125-
? widget.titlebackgroundColor
126-
: Color(0xFFE0E0E0)
127-
: widget.titlebackgroundColor),
128-
padding: widget.titlePadding != null
129-
? widget.titlePadding
130-
: EdgeInsets.all(10),
125+
border: widget.titleborderColor,
126+
color: showAccordion ? widget.expandedTitlebackgroundColor: widget.collapsedTitlebackgroundColor),
127+
padding: widget.titlePadding
128+
,
131129
child: Row(
132130
mainAxisAlignment: MainAxisAlignment.spaceBetween,
133131
children: <Widget>[
@@ -144,20 +142,13 @@ class _GFAccordionState extends State<GFAccordion>
144142
showAccordion
145143
? Container(
146144
decoration: BoxDecoration(
147-
border: widget.contentBorderColor == null
148-
? widget.contentBorderColor
149-
: Border(
150-
bottom: BorderSide(color: Colors.black38),
151-
left: BorderSide(color: Colors.black38),
152-
right: BorderSide(color: Colors.black38)),
145+
border: widget.contentBorderColor,
153146
color: widget.contentbackgroundColor != null
154147
? widget.contentbackgroundColor
155148
: Colors.white70,
156149
),
157150
width: MediaQuery.of(context).size.width,
158-
padding: widget.contentPadding != null
159-
? widget.contentPadding
160-
: EdgeInsets.all(10),
151+
padding: widget.contentPadding ,
161152
child: SlideTransition(
162153
position: offset,
163154
child: widget.content != null

lib/components/alert/gf_alert.dart

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ class GFAlert extends StatefulWidget {
1616
this.contentChild,
1717
this.title,
1818
this.bottombar,
19-
this.animationDuration = const Duration(milliseconds: 300),
20-
this.textStyle = const TextStyle(color: Colors.black87),
19+
this.contentTextStyle = const TextStyle(color: Colors.black87),
2120
this.titleTextStyle = const TextStyle(
2221
color: Colors.black87, fontSize: 17, fontWeight: FontWeight.w500)})
2322
: super(key: key);
2423

25-
/// child of type [Widget]is alternative to text key. text will get priority over child
24+
/// child of type [Widget]is alternative to title key. title will get priority over child
2625
final Widget child;
2726

28-
/// title of type [String] used to descripe the title of the [GFAlert]
27+
/// title of type [String] used to describe the title of the [GFAlert]
2928
final String title;
3029

3130
/// child of type [Widget]is alternative to title key. title will get priority over contentchild
@@ -34,24 +33,22 @@ class GFAlert extends StatefulWidget {
3433
/// title of type [String] used to describe the content of the [GFAlert]
3534
final String content;
3635

36+
///type of [TextStyle] to change the style of the title not for the child
3737
final TextStyle titleTextStyle;
3838

3939
///pass color of type [Color] or [GFColor] for background of [GFAlert]
4040
final dynamic backgroundColor;
4141

42-
/// textStyle of type [textStyle] will be applicable to text only and not for the child
43-
final TextStyle textStyle;
42+
///type of [TextStyle] to change the style of the content not for the contentchild
43+
final TextStyle contentTextStyle;
4444

4545
/// width of type [double] used to control the width of the [GFAlert]
4646
final double width;
4747

4848
///type of [GFAlertType] which takes the type ie, basic, rounded and fullWidth for the [GFAlert]
4949
final GFAlertType type;
5050

51-
///type of [Duration] which takes the duration of the fade in animation
52-
final Duration animationDuration;
53-
54-
/// type of [Alignment] used to align the text inside the toast
51+
/// type of [Alignment] used to align the text inside the [GFAlert]
5552
final Alignment alignment;
5653

5754
///type of [Widget] used for the buttons ie, OK, Cancel for the action in [GFAlert]
@@ -71,7 +68,6 @@ class _GFAlertState extends State<GFAlert> with TickerProviderStateMixin {
7168
duration: const Duration(milliseconds: 300), vsync: this);
7269
animation = CurvedAnimation(
7370
parent: animationController, curve: Curves.fastOutSlowIn);
74-
7571
animationController.forward();
7672
super.initState();
7773
}
@@ -113,9 +109,13 @@ class _GFAlertState extends State<GFAlert> with TickerProviderStateMixin {
113109
child: Column(
114110
crossAxisAlignment: CrossAxisAlignment.start,
115111
children: <Widget>[
116-
widget.title != null
117-
? Text(widget.title, style: widget.titleTextStyle)
118-
: (widget.child ?? Container()),
112+
Align(
113+
alignment: widget.alignment!=null? widget.alignment:Alignment.topLeft,
114+
child: widget.title != null
115+
? Text(widget.title, style: widget.titleTextStyle)
116+
: (widget.child ?? Container()),
117+
),
118+
119119
SizedBox(
120120
height: 10,
121121
),
@@ -124,7 +124,7 @@ class _GFAlertState extends State<GFAlert> with TickerProviderStateMixin {
124124
? widget.alignment
125125
: Alignment.topLeft,
126126
child: widget.content != null
127-
? Text(widget.content, style: widget.textStyle)
127+
? Text(widget.content, style: widget.contentTextStyle)
128128
: (widget.contentChild ?? Container()),
129129
),
130130
SizedBox(

lib/components/drawer/gf_drawer_header.dart

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
11
import 'package:flutter/widgets.dart';
22
import 'package:flutter/foundation.dart';
33
import 'package:flutter/material.dart';
4+
import 'package:getflutter/components/button/gf_icon_button.dart';
5+
import 'package:getflutter/getflutter.dart';
46

57
class GFDrawerHeaderPictures extends StatelessWidget {
6-
const GFDrawerHeaderPictures({
7-
Key key,
8-
this.currentAccountPicture,
9-
this.otherAccountsPictures,
10-
}) : super(key: key);
8+
const GFDrawerHeaderPictures(
9+
{Key key,
10+
this.currentAccountPicture,
11+
this.otherAccountsPictures,
12+
this.closeButton})
13+
: super(key: key);
1114

1215
final Widget currentAccountPicture;
1316
final List<Widget> otherAccountsPictures;
1417

18+
/// widget onTap drawer get closed
19+
final Widget closeButton;
20+
1521
@override
1622
Widget build(BuildContext context) {
1723
return Stack(
1824
children: <Widget>[
25+
closeButton == null
26+
? GFIconButton(
27+
icon: Icon(
28+
Icons.close,
29+
color: Colors.white,
30+
),
31+
onPressed: () {
32+
Navigator.pop(context);
33+
},
34+
type: GFButtonType.transparent,
35+
)
36+
: closeButton,
1937
PositionedDirectional(
2038
top: 0.0,
2139
end: 0.0,
@@ -39,7 +57,7 @@ class GFDrawerHeaderPictures extends StatelessWidget {
3957
),
4058
),
4159
Positioned(
42-
top: 0.0,
60+
top: 40.0,
4361
child: Semantics(
4462
explicitChildNodes: true,
4563
child: SizedBox(
@@ -62,16 +80,17 @@ class GFDrawerHeader extends StatefulWidget {
6280
/// Creates a material design drawer header.
6381
///
6482
/// Requires one of its ancestors to be a [Material] widget.
65-
const GFDrawerHeader({
66-
Key key,
67-
this.decoration,
68-
this.margin = const EdgeInsets.only(bottom: 8.0),
69-
this.currentAccountPicture,
70-
this.otherAccountsPictures,
71-
this.child,
72-
this.duration = const Duration(milliseconds: 250),
73-
this.curve = Curves.fastOutSlowIn,
74-
}) : super(key: key);
83+
const GFDrawerHeader(
84+
{Key key,
85+
this.decoration,
86+
this.margin = const EdgeInsets.only(bottom: 8.0),
87+
this.currentAccountPicture,
88+
this.otherAccountsPictures,
89+
this.child,
90+
this.duration = const Duration(milliseconds: 250),
91+
this.curve = Curves.fastOutSlowIn,
92+
this.closeButton})
93+
: super(key: key);
7594

7695
/// The header's background. If decoration is null then a [BoxDecoration]
7796
/// with its background color set to the current theme's primaryColor is used.
@@ -103,6 +122,9 @@ class GFDrawerHeader extends StatefulWidget {
103122
/// The curve for animations of the [decoration].
104123
final Curve curve;
105124

125+
/// widget onTap drawer get closed
126+
final Widget closeButton;
127+
106128
@override
107129
_GFDrawerHeaderState createState() => _GFDrawerHeaderState();
108130
}
@@ -112,10 +134,13 @@ class _GFDrawerHeaderState extends State<GFDrawerHeader> {
112134
Widget build(BuildContext context) {
113135
assert(debugCheckHasMaterial(context));
114136
assert(debugCheckHasMaterialLocalizations(context));
137+
final double statusBarHeight = MediaQuery.of(context).padding.top;
138+
115139
return Semantics(
116140
container: true,
117141
label: MaterialLocalizations.of(context).signedInLabel,
118-
child: DrawerHeader(
142+
child: Container(
143+
height: statusBarHeight + 185.0,
119144
decoration: widget.decoration ??
120145
BoxDecoration(
121146
color: Theme.of(context).primaryColor,
@@ -125,6 +150,7 @@ class _GFDrawerHeaderState extends State<GFDrawerHeader> {
125150
child: SafeArea(
126151
bottom: false,
127152
child: Column(
153+
mainAxisAlignment: MainAxisAlignment.center,
128154
crossAxisAlignment: CrossAxisAlignment.stretch,
129155
children: <Widget>[
130156
Expanded(
@@ -133,14 +159,16 @@ class _GFDrawerHeaderState extends State<GFDrawerHeader> {
133159
child: GFDrawerHeaderPictures(
134160
currentAccountPicture: widget.currentAccountPicture,
135161
otherAccountsPictures: widget.otherAccountsPictures,
162+
closeButton: widget.closeButton,
136163
),
137164
),
138165
),
139166
AnimatedContainer(
140-
padding: EdgeInsets.only(bottom: 16.0),
141-
duration: widget.duration,
142-
curve: widget.curve,
143-
child: widget.child),
167+
padding: EdgeInsets.only(bottom: 16.0),
168+
duration: widget.duration,
169+
curve: widget.curve,
170+
child: widget.child,
171+
),
144172
],
145173
),
146174
),

lib/components/toast/gf_toast.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class _GFToastState extends State<GFToast> with TickerProviderStateMixin {
7676
vsync: this,
7777
duration: widget.animationDuration,
7878
)..addListener(() => setState(() {}));
79+
7980
fadeanimation = Tween<double>(
8081
begin: 0.0,
8182
end: 1.0,

0 commit comments

Comments
 (0)