@@ -84,6 +84,8 @@ class CustomToast extends BaseDialog {
8484 handleMultiTypeToast (curType: type, fun: multiTypeToast);
8585 }
8686
87+ ///--------------------------multi type toast--------------------------
88+
8789 Future <void > _normalToast ({
8890 required Duration time,
8991 required Function () onShowToast,
@@ -114,7 +116,7 @@ class CustomToast extends BaseDialog {
114116 await _toastDelay (time);
115117 await _realDismiss ();
116118
117- _toastQueue.removeLast ();
119+ if (_toastQueue.isNotEmpty) _toastQueue.removeLast ();
118120 }
119121
120122 Future <void > _lastToast ({
@@ -126,7 +128,7 @@ class CustomToast extends BaseDialog {
126128 await _toastDelay (time);
127129 if (_toastQueue.length == 1 ) await _realDismiss ();
128130
129- _toastQueue.removeLast ();
131+ if (_toastQueue.isNotEmpty) _toastQueue.removeLast ();
130132 }
131133
132134 Future <void > _firstAndLastToast ({
@@ -148,10 +150,11 @@ class CustomToast extends BaseDialog {
148150 });
149151
150152 if (_toastQueue.length == 1 ) await _toastQueue.first ();
151-
152153 if (_toastQueue.length > 2 ) _toastQueue.remove (_toastQueue.elementAt (1 ));
153154 }
154155
156+ ///--------------------------multi type toast--------------------------
157+
155158 void handleMultiTypeToast ({
156159 required SmartToastType curType,
157160 required Function () fun,
@@ -200,10 +203,12 @@ class CustomToast extends BaseDialog {
200203 config.isExistToast = false ;
201204 }
202205
203- Future <void > dismiss () async {
206+ Future <void > dismiss ({bool closeAll = false }) async {
207+ if (closeAll) _toastQueue.clear ();
204208 _curTime? .cancel ();
205209 if (! (_curCompleter? .isCompleted ?? true )) _curCompleter? .complete ();
206- await Future .delayed (Duration (milliseconds: 1 ));
210+ await Future .delayed (SmartDialog .config.animationDuration);
211+ await Future .delayed (const Duration (milliseconds: 50 ));
207212 }
208213}
209214
0 commit comments