Skip to content

Commit ecf8374

Browse files
authored
Merge pull request #97 from shravyackm/loader
Loader
2 parents 6d7828a + d692c51 commit ecf8374

File tree

5 files changed

+90
-85
lines changed

5 files changed

+90
-85
lines changed

lib/components/alert/gf_alert.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class _GFAlertState extends State<GFAlert> with TickerProviderStateMixin {
9393
Container(
9494
width: widget.type == GFAlertType.fullWidth
9595
? MediaQuery.of(context).size.width
96-
: widget.width,
96+
: widget.width?? MediaQuery.of(context).size.width*0.885,
9797
constraints: const BoxConstraints(minHeight: 50),
9898
margin: widget.type == GFAlertType.fullWidth
9999
? const EdgeInsets.only(left: 0, right: 0)

lib/components/toast/gf_floating_widget.dart renamed to lib/components/floating_widget/gf_floating_widget.dart

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ class GFFloatingWidget extends StatefulWidget {
66
/// Inside floating widget [GFToast] can be used as body. See [GFToast]
77
const GFFloatingWidget(
88
{Key key,
9-
this.child,
10-
this.horizontalPosition,
11-
this.verticalPosition,
12-
this.blurnessColor,
13-
this.showblurness = false,
14-
this.body})
9+
this.child,
10+
this.horizontalPosition,
11+
this.verticalPosition,
12+
this.blurnessColor,
13+
this.showblurness = false,
14+
this.body})
1515
: super(key: key);
1616

1717
///child of type [Widget] which floats across the body based on horizontal and vertical position
@@ -39,16 +39,17 @@ class GFFloatingWidget extends StatefulWidget {
3939
class _GFFloatingWidgetState extends State<GFFloatingWidget> {
4040
@override
4141
Widget build(BuildContext context) => Stack(
42-
alignment: Alignment.center,
43-
fit: StackFit.loose,
44-
children: <Widget>[
45-
Container(
46-
height: MediaQuery.of(context).size.height,
47-
child: widget.body ?? Container(),
48-
),
49-
Positioned(
50-
child: Container(
42+
alignment: Alignment.center,
43+
fit: StackFit.loose,
44+
children: <Widget>[
45+
Container(
46+
height: MediaQuery.of(context).size.height,
47+
child: widget.body ?? Container(),
48+
),
49+
Positioned(
50+
child: Container(
5151
height: MediaQuery.of(context).size.height,
52+
width: MediaQuery.of(context).size.width,
5253
color: widget.showblurness
5354
? widget.blurnessColor ?? Colors.black54
5455
: null,
@@ -61,14 +62,11 @@ class _GFFloatingWidgetState extends State<GFFloatingWidget> {
6162
left: widget.horizontalPosition != null
6263
? widget.horizontalPosition
6364
: 0.0,
64-
right: widget.horizontalPosition != null
65-
? widget.horizontalPosition
66-
: 0.0,
6765
child: widget.child ?? Container(),
6866
)
6967
],
7068
),
7169
))
72-
],
73-
);
70+
],
71+
);
7472
}

lib/components/loader/gf_loader.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:flutter/cupertino.dart';
22
import 'package:flutter/material.dart';
3-
import 'package:getflutter/types/gf_loader_type.dart';
4-
import 'package:getflutter/size/gf_size.dart';
3+
import 'package:getflutter/getflutter.dart';
54

65
class GFLoader extends StatefulWidget {
76
const GFLoader(

lib/components/toast/gf_toast.dart

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class GFToast extends StatefulWidget {
1616
this.type = GFToastType.basic,
1717
this.autoDismiss = true,
1818
this.alignment,
19-
this.animationDuration = const Duration(seconds: 2),
20-
this.duration = const Duration(seconds: 2),
19+
this.animationDuration = const Duration(milliseconds: 300),
20+
this.duration = const Duration(milliseconds: 300),
2121
this.textStyle = const TextStyle(color: Colors.white70),
2222
}) : super(key: key);
2323

@@ -66,7 +66,7 @@ class _GFToastState extends State<GFToast> with TickerProviderStateMixin {
6666
@override
6767
void initState() {
6868
animationController = AnimationController(
69-
duration: const Duration(milliseconds: 2000),
69+
duration: widget.duration,
7070
vsync: this,
7171
);
7272
animation = CurvedAnimation(
@@ -109,64 +109,64 @@ class _GFToastState extends State<GFToast> with TickerProviderStateMixin {
109109
}
110110

111111
@override
112-
Widget build(BuildContext context) => hideToast
113-
? Container()
114-
: FadeTransition(
115-
opacity: widget.autoDismiss ? fadeanimation : animation,
116-
child: Column(
117-
children: <Widget>[
118-
Container(
119-
width: widget.type == GFToastType.fullWidth
120-
? MediaQuery.of(context).size.width
121-
: widget.width,
122-
constraints: const BoxConstraints(minHeight: 50),
123-
margin: widget.type == GFToastType.fullWidth
124-
? const EdgeInsets.only(left: 0, right: 0)
125-
: const EdgeInsets.only(left: 10, right: 10),
126-
padding: const EdgeInsets.all(10),
127-
decoration: BoxDecoration(
128-
borderRadius: widget.type == GFToastType.basic
129-
? BorderRadius.circular(0)
130-
: widget.type == GFToastType.rounded
131-
? BorderRadius.circular(10)
132-
: BorderRadius.zero,
133-
color: widget.backgroundColor != null
134-
? GFColors.getGFColor(widget.backgroundColor)
135-
: const Color(0xff323232),
136-
boxShadow: [
137-
BoxShadow(
138-
color: Colors.black.withOpacity(0.40),
139-
blurRadius: 6,
140-
)
141-
]),
142-
child: Row(
143-
children: <Widget>[
144-
Flexible(
145-
flex: 7,
146-
fit: FlexFit.tight,
147-
child: Align(
148-
alignment: widget.alignment ?? Alignment.topLeft,
149-
child: widget.text != null
150-
? Text(widget.text, style: widget.textStyle)
151-
: (widget.child ?? Container()),
152-
),
153-
),
154-
const SizedBox(
155-
width: 10,
156-
),
157-
widget.button != null
158-
? Flexible(
159-
flex: 4,
160-
fit: FlexFit.tight,
161-
child: Align(
162-
alignment: Alignment.topRight,
163-
child: widget.button,
164-
))
165-
: Container()
166-
],
112+
Widget build(BuildContext context) => hideToast? Container():FadeTransition(
113+
opacity: widget.autoDismiss ? fadeanimation : animation,
114+
child:
115+
Column(
116+
children: <Widget>[
117+
Container(
118+
width: widget.type == GFToastType.fullWidth
119+
? MediaQuery.of(context).size.width
120+
: widget.width?? MediaQuery.of(context).size.width*0.885,
121+
constraints: const BoxConstraints(minHeight: 50),
122+
margin: widget.type == GFToastType.fullWidth
123+
? const EdgeInsets.only(left: 0, right: 0)
124+
: const EdgeInsets.only(left: 10, right: 10),
125+
padding: const EdgeInsets.all(10),
126+
decoration: BoxDecoration(
127+
borderRadius: widget.type == GFToastType.basic
128+
? BorderRadius.circular(0)
129+
: widget.type == GFToastType.rounded
130+
? BorderRadius.circular(10)
131+
: BorderRadius.zero,
132+
color: widget.backgroundColor != null
133+
? GFColors.getGFColor(widget.backgroundColor)
134+
: const Color(0xff323232),
135+
boxShadow: [
136+
BoxShadow(
137+
color: Colors.black.withOpacity(0.40),
138+
blurRadius: 6,
139+
)
140+
]),
141+
child: Row(
142+
children: <Widget>[
143+
Flexible(
144+
flex: 7,
145+
fit: FlexFit.tight,
146+
child: Align(
147+
alignment: widget.alignment ?? Alignment.topLeft,
148+
child: widget.text != null
149+
? Text(widget.text, style: widget.textStyle)
150+
: (widget.child ?? Container()),
151+
),
167152
),
168-
),
169-
],
153+
const SizedBox(
154+
width: 10,
155+
),
156+
widget.button != null
157+
? Flexible(
158+
flex: 4,
159+
fit: FlexFit.tight,
160+
child: Align(
161+
alignment: Alignment.topRight,
162+
child: widget.button,
163+
))
164+
: Container()
165+
],
166+
),
170167
),
171-
);
168+
],
169+
)
170+
171+
);
172172
}

lib/getflutter.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
library getflutter;
22

33
//exports components
4+
export 'package:getflutter/components/alert/gf_alert.dart';
5+
export 'package:getflutter/components/accordian/gf_accordian.dart';
46
export 'package:getflutter/components/appbar/gf_appbar.dart';
57
export 'package:getflutter/components/avatar/gf_avatar.dart';
68
export 'package:getflutter/components/badge/gf_badge.dart';
@@ -22,22 +24,28 @@ export 'package:getflutter/components/tabs/gf_tabbar.dart';
2224
export 'package:getflutter/components/tabs/gf_tabbar_view.dart';
2325
export 'package:getflutter/components/tabs/gf_tabs.dart';
2426
export 'package:getflutter/components/tabs/gf_segment_tabs.dart';
25-
export 'package:getflutter/components/toast/gf_floating_widget.dart';
27+
export 'package:getflutter/components/floating_widget/gf_floating_widget.dart';
2628
export 'package:getflutter/components/toast/gf_toast.dart';
2729
export 'package:getflutter/components/toggle/gf_toggle.dart';
2830
export 'package:getflutter/components/typography/gf_typography.dart';
2931
export 'package:getflutter/components/rating/gf_rating.dart';
3032
export 'package:getflutter/components/slidable/gf_slidable.dart';
33+
export 'package:getflutter/components/loader/gf_loader.dart';
3134

3235
// exports shape, color, position, size, types
36+
3337
export 'colors/gf_color.dart';
3438
export 'position/gf_position.dart';
3539
export 'shape/gf_avatar_shape.dart';
3640
export 'shape/gf_badge_shape.dart';
3741
export 'shape/gf_button_shape.dart';
3842
export 'shape/gf_icon_button_shape.dart';
3943
export 'size/gf_size.dart';
44+
export 'types/gf_alert_type.dart';
4045
export 'types/gf_button_type.dart';
46+
export 'types/gf_loader_type.dart';
4147
export 'types/gf_toast_type.dart';
4248
export 'types/gf_toggle_type.dart';
4349
export 'types/gf_typography_type.dart';
50+
51+

0 commit comments

Comments
 (0)