Skip to content

Commit 2fbf7e0

Browse files
committed
publish 4.9.0
1 parent f4d2108 commit 2fbf7e0

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# [4.9.0]
2+
- Breaking Change
3+
- refactor Toast: remove 'SmartToastType.first' and 'SmartToastType.firstAndLast'
4+
- Feature
5+
- add 'SmartToastType.multi': Can display multi toasts at the same time
6+
- add showNotify: By setting NotifyType, many different types of Notify dialog can be used
7+
- showNotify custom style: You can set the default dialog style for showNotify through the notifyStyle parameter in FlutterSmartDialog.init ()
8+
- solve [#102](https://github.com/fluttercandies/flutter_smart_dialog/issues/102)
9+
- fix [#110](https://github.com/fluttercandies/flutter_smart_dialog/issues/110)
10+
- solve [#111](https://github.com/fluttercandies/flutter_smart_dialog/issues/111)
11+
12+
113
# [4.8.x]
214
- Breaking Change
315
- If the 'bindPage' of the dialog is false, the dialog will not be closed when the page is closed

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class SmartDialogPage extends StatelessWidget {
6868
void _showToast() async {
6969
SmartDialog.showToast(
7070
'test toast ---- ${Random().nextInt(999)}',
71-
displayType: SmartToastType.multi,
71+
displayType: SmartToastType.last,
7272
);
7373
}
7474

lib/src/custom/toast/custom_toast.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,12 @@ class CustomToast extends BaseDialog {
155155
curToast.onShowToast();
156156
if (toastQueue.length > 1 &&
157157
toastQueue.elementAt(1).type == SmartToastType.last) {
158-
curToast.time = Duration(milliseconds: 50);
158+
toastQueue.remove(curToast);
159+
curToast.mainDialog.overlayEntry.remove();
160+
} else {
161+
await ToastTool.instance.delay(curToast.time);
162+
await ToastTool.instance.dismiss(curToast: curToast);
159163
}
160-
await ToastTool.instance.delay(curToast.time);
161-
await ToastTool.instance.dismiss();
162164
ToastTool.instance.dispatchNext();
163165
}
164166

lib/src/custom/toast/toast_tool.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ class ToastTool {
1616

1717
Queue<ToastInfo> toastQueue = ListQueue();
1818

19-
Future<void> dismiss({bool closeAll = false}) async {
19+
Future<void> dismiss({bool closeAll = false, ToastInfo? curToast}) async {
2020
if (toastQueue.isEmpty) {
2121
return;
2222
}
2323

24-
var curToast = toastQueue.first;
24+
if (curToast != null && !toastQueue.contains(curToast)) {
25+
return;
26+
}
27+
28+
curToast = curToast ?? toastQueue.first;
2529
toastQueue.remove(curToast);
2630
if (closeAll) {
2731
toastQueue.clear();

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description:
33
An elegant Flutter Dialog solution,
44
Easily implement Toast, Loading and custom Dialog,
55
Make the use of the dialog easier!
6-
version: 4.8.2+5
6+
version: 4.9.0
77
homepage: https://github.com/fluttercandies/flutter_smart_dialog
88
# flutter pub publish --server=https://pub.dartlang.org
99

0 commit comments

Comments
 (0)