Skip to content

Commit 9c921a7

Browse files
committed
toast types added
1 parent 6df478c commit 9c921a7

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

lib/components/toast/gf_toast.dart

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
33
import 'package:flutter/widgets.dart';
44
import 'package:getflutter/colors/gf_color.dart';
55
import 'package:getflutter/components/toast/gf_floating_widget.dart';
6+
import 'package:getflutter/types/gf_toast_type.dart';
67

78
class GFToast extends StatefulWidget {
89
///Creates [GFToast] that can be used to display quick warning or error messages.
@@ -14,6 +15,8 @@ class GFToast extends StatefulWidget {
1415
this.backgroundColor,
1516
this.text,
1617
this.width,
18+
this.type= GFToastType.basic,
19+
1720

1821
this.textStyle = const TextStyle(color: Colors.white70),
1922
}) : super(key: key);
@@ -36,6 +39,10 @@ class GFToast extends StatefulWidget {
3639
/// width od type [double] used to control the width od the [GFToast]
3740
final double width;
3841

42+
final GFToastType type ;
43+
44+
45+
3946

4047

4148
@override
@@ -81,14 +88,22 @@ class _GFToastState extends State<GFToast> with TickerProviderStateMixin {
8188
Container(
8289
width: widget.width ,
8390
constraints: BoxConstraints(minHeight: 50.0),
84-
// width: 100,
85-
margin: EdgeInsets.only(left: 10, right: 10),
91+
margin: widget.type == GFToastType.fullWidth ? EdgeInsets.only(left: 0, right: 0): EdgeInsets.only(left: 10, right: 10),
8692
padding: EdgeInsets.all(10),
8793
decoration: BoxDecoration(
88-
borderRadius: BorderRadius.all(Radius.circular(3)),
94+
// borderRadius: BorderRadius.all(Radius.circular(3)),
95+
borderRadius: widget.type == GFToastType.basic
96+
? BorderRadius.circular(0.0)
97+
: widget.type == GFToastType.rounded
98+
? BorderRadius.circular(10.0): BorderRadius.zero,
8999
color: widget.backgroundColor != null
90100
? getGFColor(widget.backgroundColor)
91101
: Color(0xff323232),
102+
boxShadow: [
103+
BoxShadow(
104+
color: Colors.black.withOpacity(0.40), blurRadius: 6.0
105+
)
106+
]
92107
),
93108
child: Row(
94109
children: <Widget>[

lib/types/gf_toast_type.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enum GFToastType {basic, rounded, fullWidth}

0 commit comments

Comments
 (0)