@@ -27,7 +27,7 @@ const _defaultDuration = Duration(
27
27
ToastFuture showToast (
28
28
String msg, {
29
29
BuildContext context,
30
- Duration duration = _defaultDuration ,
30
+ Duration duration,
31
31
ToastPosition position,
32
32
TextStyle textStyle,
33
33
EdgeInsetsGeometry textPadding,
@@ -43,17 +43,14 @@ ToastFuture showToast(
43
43
}) {
44
44
context ?? = _contextMap.values.first;
45
45
46
- textStyle ?? = _ToastTheme .of (context).textStyle ?? TextStyle (fontSize: 15.0 );
47
-
48
- textAlign ?? = _ToastTheme .of (context).textAlign;
49
-
50
- textPadding ?? = _ToastTheme .of (context).textPadding;
51
-
52
- position ?? = _ToastTheme .of (context).position;
53
- backgroundColor ?? = _ToastTheme .of (context).backgroundColor;
54
- radius ?? = _ToastTheme .of (context).radius;
55
-
56
- textDirection ?? = _ToastTheme .of (context).textDirection ?? TextDirection .ltr;
46
+ final theme = _ToastTheme .of (context);
47
+ textStyle ?? = theme.textStyle ?? TextStyle (fontSize: 15.0 );
48
+ textAlign ?? = theme.textAlign;
49
+ textPadding ?? = theme.textPadding;
50
+ position ?? = theme.position;
51
+ backgroundColor ?? = theme.backgroundColor;
52
+ radius ?? = theme.radius;
53
+ textDirection ?? = theme.textDirection ?? TextDirection .ltr;
57
54
58
55
Widget widget = Container (
59
56
margin: const EdgeInsets .all (50.0 ),
@@ -88,7 +85,7 @@ ToastFuture showToast(
88
85
ToastFuture showToastWidget (
89
86
Widget widget, {
90
87
BuildContext context,
91
- Duration duration = _defaultDuration ,
88
+ Duration duration,
92
89
ToastPosition position,
93
90
VoidCallback onDismiss,
94
91
bool dismissOtherToast,
@@ -109,6 +106,7 @@ ToastFuture showToastWidget(
109
106
animationDuration ?? =
110
107
theme.animationDuration ?? const Duration (milliseconds: 250 );
111
108
animationCurve ?? = theme.animationCurve ?? Curves .easeIn;
109
+ duration ?? = theme.duration ?? _defaultDuration;
112
110
113
111
final movingOnWindowChange = theme? .movingOnWindowChange ?? false ;
114
112
0 commit comments