Skip to content

Commit fc5dafd

Browse files
authored
Merge pull request #70 from shravyackm/toast
Toast
2 parents 98cf835 + 15debf4 commit fc5dafd

File tree

3 files changed

+116
-102
lines changed

3 files changed

+116
-102
lines changed

lib/components/accordian/gf_accordian.dart

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ class GFAccordion extends StatefulWidget {
88
this.content,
99
this.titlebackgroundColor,
1010
this.collapsedIcon = const Icon(Icons.keyboard_arrow_down),
11-
this.expandedIcon =
12-
const Icon(Icons.keyboard_arrow_up, color: Colors.red),
11+
this.expandedIcon = const Icon(Icons.keyboard_arrow_up),
1312
this.title,
1413
this.textStyle = const TextStyle(color: Colors.black, fontSize: 16),
1514
this.titlePadding,
16-
this.descriptionPadding,
17-
this.descriptionbackgroundColor,
15+
this.contentbackgroundColor,
16+
this.contentPadding,
1817
this.contentChild,
18+
this.titleborderColor,
19+
this.contentBorderColor,
1920
this.margin})
2021
: super(key: key);
2122

@@ -47,14 +48,20 @@ class GFAccordion extends StatefulWidget {
4748
final EdgeInsets titlePadding;
4849

4950
///descriptionPadding of type [EdgeInsets] which is used to set the padding of the [GFAccordion] description
50-
final EdgeInsets descriptionPadding;
51+
final EdgeInsets contentPadding;
5152

5253
/// type of [Color] or [GFColor] which is used to change the background color of the [GFAccordion] description
53-
final dynamic descriptionbackgroundColor;
54+
final dynamic contentbackgroundColor;
5455

5556
///margin of type [EdgeInsets] which is used to set the margin of the [GFAccordion]
5657
final EdgeInsets margin;
5758

59+
///titleborderColor of type [Color] or [GFColor] which is used to change the border color of title
60+
final dynamic titleborderColor;
61+
62+
///contentBorderColor of type [Color] or [GFColor] which is used to change the border color of content
63+
final dynamic contentBorderColor;
64+
5865
@override
5966
_GFAccordionState createState() => _GFAccordionState();
6067
}
@@ -105,9 +112,19 @@ class _GFAccordionState extends State<GFAccordion>
105112
});
106113
},
107114
child: Container(
108-
color: widget.titlebackgroundColor != null
109-
? widget.titlebackgroundColor
110-
: Colors.white,
115+
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),
111128
padding: widget.titlePadding != null
112129
? widget.titlePadding
113130
: EdgeInsets.all(10),
@@ -126,12 +143,20 @@ class _GFAccordionState extends State<GFAccordion>
126143
),
127144
showAccordion
128145
? Container(
146+
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)),
153+
color: widget.contentbackgroundColor != null
154+
? widget.contentbackgroundColor
155+
: Colors.white70,
156+
),
129157
width: MediaQuery.of(context).size.width,
130-
color: widget.descriptionbackgroundColor != null
131-
? widget.descriptionbackgroundColor
132-
: Colors.white70,
133-
padding: widget.descriptionPadding != null
134-
? widget.descriptionPadding
158+
padding: widget.contentPadding != null
159+
? widget.contentPadding
135160
: EdgeInsets.all(10),
136161
child: SlideTransition(
137162
position: offset,

lib/components/alert/gf_alert.dart

Lines changed: 51 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class GFAlert extends StatefulWidget {
5656

5757
///type of [Widget] used for the buttons ie, OK, Cancel for the action in [GFAlert]
5858
final Widget bottombar;
59+
5960
@override
6061
_GFAlertState createState() => _GFAlertState();
6162
}
@@ -83,66 +84,58 @@ class _GFAlertState extends State<GFAlert> with TickerProviderStateMixin {
8384

8485
@override
8586
Widget build(BuildContext context) {
86-
return Stack(
87-
children: <Widget>[
88-
Container(
89-
height: MediaQuery.of(context).size.height,
90-
),
91-
FadeTransition(
92-
opacity: animation,
93-
child: Column(
94-
children: <Widget>[
95-
Container(
96-
width: widget.type == GFAlertType.fullWidth
97-
? MediaQuery.of(context).size.width
98-
: widget.width,
99-
constraints: BoxConstraints(minHeight: 50.0),
100-
margin: widget.type == GFAlertType.fullWidth
101-
? EdgeInsets.only(left: 0, right: 0)
102-
: EdgeInsets.only(left: 20, right: 20),
103-
padding: EdgeInsets.all(15),
104-
decoration: BoxDecoration(
105-
borderRadius: widget.type == GFAlertType.basic
106-
? BorderRadius.circular(3.0)
107-
: widget.type == GFAlertType.rounded
108-
? BorderRadius.circular(10.0)
109-
: BorderRadius.zero,
110-
color: widget.backgroundColor != null
111-
? GFColors.getGFColor(widget.backgroundColor)
112-
: GFColors.getGFColor(GFColor.white),
113-
boxShadow: [
114-
BoxShadow(
115-
color: Colors.black.withOpacity(0.40),
116-
blurRadius: 3.0)
117-
]),
118-
child: Column(
119-
crossAxisAlignment: CrossAxisAlignment.start,
120-
children: <Widget>[
121-
widget.title != null
122-
? Text(widget.title, style: widget.titleTextStyle)
123-
: (widget.child ?? Container()),
124-
SizedBox(
125-
height: 10,
126-
),
127-
Align(
128-
alignment: widget.alignment != null
129-
? widget.alignment
130-
: Alignment.topLeft,
131-
child: widget.content != null
132-
? Text(widget.content, style: widget.textStyle)
133-
: (widget.contentChild ?? Container()),
134-
),
135-
SizedBox(
136-
height: 10,
137-
),
138-
widget.bottombar != null ? widget.bottombar : Container(),
139-
],
87+
return FadeTransition(
88+
opacity: animation,
89+
child: Column(
90+
children: <Widget>[
91+
Container(
92+
width: widget.type == GFAlertType.fullWidth
93+
? MediaQuery.of(context).size.width
94+
: widget.width,
95+
constraints: BoxConstraints(minHeight: 50.0),
96+
margin: widget.type == GFAlertType.fullWidth
97+
? EdgeInsets.only(left: 0, right: 0)
98+
: EdgeInsets.only(left: 20, right: 20),
99+
padding: EdgeInsets.all(15),
100+
decoration: BoxDecoration(
101+
borderRadius: widget.type == GFAlertType.basic
102+
? BorderRadius.circular(3.0)
103+
: widget.type == GFAlertType.rounded
104+
? BorderRadius.circular(10.0)
105+
: BorderRadius.zero,
106+
color: widget.backgroundColor != null
107+
? GFColors.getGFColor(widget.backgroundColor)
108+
: GFColors.getGFColor(GFColor.white),
109+
boxShadow: [
110+
BoxShadow(
111+
color: Colors.black.withOpacity(0.40), blurRadius: 3.0)
112+
]),
113+
child: Column(
114+
crossAxisAlignment: CrossAxisAlignment.start,
115+
children: <Widget>[
116+
widget.title != null
117+
? Text(widget.title, style: widget.titleTextStyle)
118+
: (widget.child ?? Container()),
119+
SizedBox(
120+
height: 10,
121+
),
122+
Align(
123+
alignment: widget.alignment != null
124+
? widget.alignment
125+
: Alignment.topLeft,
126+
child: widget.content != null
127+
? Text(widget.content, style: widget.textStyle)
128+
: (widget.contentChild ?? Container()),
129+
),
130+
SizedBox(
131+
height: 10,
140132
),
141-
),
142-
],
133+
widget.bottombar != null ? widget.bottombar : Container(),
134+
],
135+
),
143136
),
144-
),
145-
],
137+
],
138+
),
146139
);
147140
}
148141
}

lib/components/toast/gf_floating_widget.dart

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class GFFloatingWidget extends StatefulWidget {
99
this.child,
1010
this.horizontalPosition,
1111
this.verticalPosition,
12-
this.color,
13-
this.blur = false,
12+
this.blurnessColor,
13+
this.showblurness = false,
1414
this.body})
1515
: super(key: key);
1616

@@ -26,9 +26,11 @@ class GFFloatingWidget extends StatefulWidget {
2626
/// verticalPosition of type [double] which aligns the child vertically across the body
2727
final double verticalPosition;
2828

29-
final dynamic color;
29+
///blurnessColor of tye [Color] or [GFColor] which is used to blur the backgroundColor when ever the [child] is used in [GFFloatingWidget]
30+
final dynamic blurnessColor;
3031

31-
final bool blur;
32+
///type of bool which allows to show or hide the blurness of the backgroundColor whenever the [child] is used in [GFFloatingWidget]
33+
final bool showblurness;
3234

3335
@override
3436
_GFFloatingWidgetState createState() => _GFFloatingWidgetState();
@@ -45,32 +47,26 @@ class _GFFloatingWidgetState extends State<GFFloatingWidget> {
4547
height: MediaQuery.of(context).size.height,
4648
child: widget.body ?? Container(),
4749
),
48-
Container(
49-
// color: widget.child!=null? widget.color: null,
50-
child: Stack(
51-
children: <Widget>[
52-
Positioned(
53-
child: Container(
54-
alignment: Alignment.topLeft,
55-
// color: widget.child!=null? widget.color: null,
56-
color: widget.blur ? Colors.black38 : null,
57-
child: Stack(
58-
children: <Widget>[
59-
Positioned(
60-
top: widget.verticalPosition != null
61-
? widget.verticalPosition
62-
: 0.0,
63-
left: widget.horizontalPosition != null
64-
? widget.horizontalPosition
65-
: 0.0,
66-
right: widget.horizontalPosition != null
67-
? widget.horizontalPosition
68-
: 0.0,
69-
child: widget.child ?? Container(),
70-
)
71-
],
72-
))),
73-
],
50+
Positioned(
51+
child: Container(
52+
height: MediaQuery.of(context).size.height,
53+
color: widget.showblurness ? widget.blurnessColor : null,
54+
child: Stack(
55+
children: <Widget>[
56+
Positioned(
57+
top: widget.verticalPosition != null
58+
? widget.verticalPosition
59+
: 0.0,
60+
left: widget.horizontalPosition != null
61+
? widget.horizontalPosition
62+
: 0.0,
63+
right: widget.horizontalPosition != null
64+
? widget.horizontalPosition
65+
: 0.0,
66+
child: widget.child ?? Container(),
67+
)
68+
],
69+
),
7470
))
7571
],
7672
);

0 commit comments

Comments
 (0)