Skip to content

Commit f090460

Browse files
committed
optimize
1 parent e4f38c1 commit f090460

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# [4.0.x]
2+
3+
- Breaking Change!!! migrate doc: [3.x migrate 4.0]() | [3.x 迁移 4.0]()
4+
- Major update
5+
- Subdivided 'config', can control 'show', 'showAttach', 'showLoading', 'showToast' in more detail
6+
- Add 'bindPage' feature, it can reasonably solve the problem of dialog jumping pages
7+
- Now 'dismiss' can carry the return value, similar to pop and push usage
8+
- You can use the 'permanent' param to set a permanent dialog
9+
- The interval time that can be added between successive displays of toasts
10+
- Loading can set the least loading time
11+
- Add click listener for dialog mask
12+
113
# [3.4.x]
214

315
- 'showToast' add 'consumeEvent' param: [#27](https://github.com/fluttercandies/flutter_smart_dialog/issues/27)

lib/src/custom/custom_dialog.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class CustomDialog extends BaseDialog {
7373
reuse: true,
7474
onMask: () {
7575
onMask?.call();
76-
if (!clickMaskDismiss || !_clickMaskDebounce()) return;
76+
if (!clickMaskDismiss || !_clickMaskDebounce() || permanent) return;
7777
dismiss();
7878
},
7979
);
@@ -128,7 +128,7 @@ class CustomDialog extends BaseDialog {
128128
useSystem: useSystem,
129129
onMask: () {
130130
onMask?.call();
131-
if (!clickMaskDismiss || !_clickMaskDebounce()) return;
131+
if (!clickMaskDismiss || !_clickMaskDebounce() || permanent) return;
132132
dismiss();
133133
},
134134
);

lib/src/custom/custom_toast.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class CustomToast extends BaseDialog {
6262
);
6363
}
6464

65-
multiTypeToast() async {
65+
Future<void> multiTypeToast() async {
6666
// provider multiple toast display logic
6767
if (displayType == SmartToastType.normal) {
6868
await _normalToast(time: displayTime, onShowToast: showToast);
@@ -78,7 +78,7 @@ class CustomToast extends BaseDialog {
7878
}
7979

8080
//handling different types of toast
81-
handleMultiTypeToast(curType: displayType, fun: multiTypeToast);
81+
await handleMultiTypeToast(curType: displayType, fun: multiTypeToast);
8282
}
8383

8484
///--------------------------multi type toast--------------------------
@@ -152,15 +152,15 @@ class CustomToast extends BaseDialog {
152152

153153
///--------------------------multi type toast--------------------------
154154
155-
void handleMultiTypeToast({
155+
Future<void> handleMultiTypeToast({
156156
required SmartToastType curType,
157-
required Function() fun,
157+
required Future<void> Function() fun,
158158
}) async {
159159
_lastType = _lastType ?? curType;
160160
if (_lastType != curType || _tempQueue.isNotEmpty) {
161161
_tempQueue.add(_ToastInfo(type: curType, fun: fun));
162162
} else {
163-
fun();
163+
await fun();
164164
}
165165
_lastType = curType;
166166
}
@@ -215,5 +215,5 @@ class _ToastInfo {
215215
_ToastInfo({required this.type, required this.fun});
216216

217217
SmartToastType type;
218-
Function() fun;
218+
Future<void> Function() fun;
219219
}

0 commit comments

Comments
 (0)