Skip to content

Commit a567166

Browse files
committed
gf-floating widget done
1 parent 0192fbb commit a567166

File tree

4 files changed

+68
-62
lines changed

4 files changed

+68
-62
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/floating_widget/gf_floating_widget.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class _GFFloatingWidgetState extends State<GFFloatingWidget> {
4949
Positioned(
5050
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,

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: 5 additions & 0 deletions
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';
@@ -31,16 +33,19 @@ export 'package:getflutter/components/slidable/gf_slidable.dart';
3133
export 'package:getflutter/components/loader/gf_loader.dart';
3234

3335
// exports shape, color, position, size, types
36+
3437
export 'colors/gf_color.dart';
3538
export 'position/gf_position.dart';
3639
export 'shape/gf_avatar_shape.dart';
3740
export 'shape/gf_badge_shape.dart';
3841
export 'shape/gf_button_shape.dart';
3942
export 'shape/gf_icon_button_shape.dart';
4043
export 'size/gf_size.dart';
44+
export 'types/gf_alert_type.dart';
4145
export 'types/gf_button_type.dart';
4246
export 'types/gf_loader_type.dart';
4347
export 'types/gf_toast_type.dart';
4448
export 'types/gf_toggle_type.dart';
4549
export 'types/gf_typography_type.dart';
4650

51+

0 commit comments

Comments
 (0)