Skip to content

Commit 26a6bac

Browse files
committed
notice: 'antiShake' renamed 'debounce'
1 parent 252b186 commit 26a6bac

File tree

8 files changed

+45
-41
lines changed

8 files changed

+45
-41
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# [3.3.x]
2+
3+
- notice: 'antiShake' renamed 'debounce'
4+
15
# [3.2.x]
26

37
- Major update!
@@ -17,7 +21,7 @@
1721
- support open multi dialog
1822
- Monitor back and pop event, then close dialog reasonably
1923
- Initialization is more concise
20-
- Add anti-shake function
24+
- Add debounce feature
2125
- Add close all dialog status
2226
- Adjustment comment
2327
- Add four toast display logic

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ SmartDialog.config
167167
..animationDuration = Duration(milliseconds: 260)
168168
..isUseAnimation = true
169169
..isLoading = true
170-
..antiShake = false
171-
..antiShakeTime = Duration(milliseconds: 300);
170+
..debounce = false
171+
..debounceTime = Duration(milliseconds: 300);
172172
```
173173

174174
# Attach Chapter

lib/src/custom/custom_dialog.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CustomDialog extends BaseDialog {
3737
required bool isLoading,
3838
required Color maskColor,
3939
required bool clickBgDismiss,
40-
required bool antiShake,
40+
required bool debounce,
4141
required Widget? maskWidget,
4242
required VoidCallback? onDismiss,
4343
required String? tag,
@@ -49,7 +49,7 @@ class CustomDialog extends BaseDialog {
4949
tag: tag,
5050
backDismiss: backDismiss,
5151
keepSingle: keepSingle,
52-
antiShake: antiShake,
52+
debounce: debounce,
5353
type: DialogType.custom,
5454
);
5555
return mainDialog.show(
@@ -81,7 +81,7 @@ class CustomDialog extends BaseDialog {
8181
required bool isLoading,
8282
required Color maskColor,
8383
required bool clickBgDismiss,
84-
required bool antiShake,
84+
required bool debounce,
8585
required Widget? maskWidget,
8686
required Positioned highlight,
8787
required HighlightBuilder? highlightBuilder,
@@ -95,7 +95,7 @@ class CustomDialog extends BaseDialog {
9595
tag: tag,
9696
backDismiss: backDismiss,
9797
keepSingle: keepSingle,
98-
antiShake: antiShake,
98+
debounce: debounce,
9999
type: DialogType.attach,
100100
);
101101
return mainDialog.showAttach(
@@ -148,11 +148,11 @@ class CustomDialog extends BaseDialog {
148148
required String? tag,
149149
required bool backDismiss,
150150
required bool keepSingle,
151-
required bool antiShake,
151+
required bool debounce,
152152
required DialogType type,
153153
}) {
154154
// debounce
155-
if (!_checkDebounce(antiShake)) return;
155+
if (!_checkDebounce(debounce)) return;
156156

157157
//handle dialog stack
158158
_handleDialogStack(
@@ -216,14 +216,14 @@ class CustomDialog extends BaseDialog {
216216
);
217217
}
218218

219-
bool _checkDebounce(bool antiShake) {
220-
if (!antiShake) return true;
219+
bool _checkDebounce(bool debounce) {
220+
if (!debounce) return true;
221221

222222
var proxy = DialogProxy.instance;
223223
var now = DateTime.now();
224224
var isShake = proxy.dialogLastTime != null &&
225225
now.difference(proxy.dialogLastTime!) <
226-
SmartDialog.config.antiShakeTime;
226+
SmartDialog.config.debounceTime;
227227
proxy.dialogLastTime = now;
228228
if (isShake) return false;
229229

lib/src/custom/custom_toast.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ class CustomToast extends BaseDialog {
2323
required Color maskColor,
2424
required Widget? maskWidget,
2525
required Duration time,
26-
required bool antiShake,
26+
required bool debounce,
2727
required SmartToastType type,
2828
required Widget widget,
2929
}) async {
3030
// debounce
31-
if (antiShake) {
31+
if (debounce) {
3232
var now = DateTime.now();
3333
var isShake = _lastTime != null &&
34-
now.difference(_lastTime!) < SmartDialog.config.antiShakeTime;
34+
now.difference(_lastTime!) < SmartDialog.config.debounceTime;
3535
_lastTime = now;
3636
if (isShake) return;
3737
}

lib/src/helper/config.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@ class Config {
6565
/// 点击遮罩,是否关闭dialog(默认:true):true(点击遮罩关闭dialog),false(不关闭)
6666
bool clickBgDismiss = true;
6767

68-
/// debounce function,it works on toast and dialog:default(false);
69-
/// you can use the [antiShakeTime] param to set the debounce time
68+
/// debounce feature,it works on toast and dialog:default(false);
69+
/// you can use the [debounceTime] param to set the debounce time
7070
///
7171
/// 防抖功能(debounce),它作用于toast和dialog上:默认(false);
72-
/// 可以通过[antiShakeTime]参数设置防抖时间
73-
bool antiShake = false;
74-
Duration antiShakeTime = Duration(milliseconds: 300);
72+
/// 可以通过[debounceTime]参数设置防抖时间
73+
bool debounce = false;
74+
Duration debounceTime = Duration(milliseconds: 300);
7575

7676
/// whether loading and custom dialog exist on the screen
7777
///
78-
/// loading和自定义dialog,是否存在在界面上
78+
/// loading,自定义dialog和attach,是否存在在界面上
7979
bool isExist = false;
8080

8181
/// whether custom dialog exist on the screen
8282
///
83-
/// 自定义dialog是否存在在界面上
83+
/// 自定义dialog和attach是否存在在界面上
8484
bool isExistMain = false;
8585

8686
/// whether loading exist on the screen

lib/src/helper/dialog_proxy.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class DialogProxy {
5757
required Color maskColor,
5858
required bool clickBgDismiss,
5959
required Widget? maskWidget,
60-
required bool antiShake,
60+
required bool debounce,
6161
required VoidCallback? onDismiss,
6262
required String? tag,
6363
required bool backDismiss,
@@ -79,7 +79,7 @@ class DialogProxy {
7979
maskWidget: maskWidget,
8080
clickBgDismiss: clickBgDismiss,
8181
onDismiss: onDismiss,
82-
antiShake: antiShake,
82+
debounce: debounce,
8383
tag: tag,
8484
backDismiss: backDismiss,
8585
keepSingle: keepSingle,
@@ -100,7 +100,7 @@ class DialogProxy {
100100
required Widget? maskWidget,
101101
required Positioned highlight,
102102
required HighlightBuilder? highlightBuilder,
103-
required bool antiShake,
103+
required bool debounce,
104104
required VoidCallback? onDismiss,
105105
required String? tag,
106106
required bool backDismiss,
@@ -126,7 +126,7 @@ class DialogProxy {
126126
highlightBuilder: highlightBuilder,
127127
clickBgDismiss: clickBgDismiss,
128128
onDismiss: onDismiss,
129-
antiShake: antiShake,
129+
debounce: debounce,
130130
tag: tag,
131131
backDismiss: backDismiss,
132132
keepSingle: keepSingle,
@@ -166,7 +166,7 @@ class DialogProxy {
166166
required Color maskColor,
167167
required Widget? maskWidget,
168168
required Duration time,
169-
required bool antiShake,
169+
required bool debounce,
170170
required SmartToastType type,
171171
required Widget widget,
172172
}) async {
@@ -179,7 +179,7 @@ class DialogProxy {
179179
maskColor: maskColor,
180180
maskWidget: maskWidget,
181181
time: time,
182-
antiShake: antiShake,
182+
debounce: debounce,
183183
type: type,
184184
widget: ToastHelper(child: widget),
185185
);

lib/src/smart_dialog.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class SmartDialog {
8787
///
8888
/// [maskWidgetTemp]:highly customizable mask
8989
///
90-
/// [antiShakeTemp]:anti-shake function(debounce
90+
/// [debounceTemp]debounce feature
9191
///
9292
/// [onDismiss]:the callback will be invoked when the dialog is closed
9393
///
@@ -120,7 +120,7 @@ class SmartDialog {
120120
///
121121
/// [maskWidgetTemp]:可高度定制遮罩
122122
///
123-
/// [antiShakeTemp]:防抖功能(debounce)
123+
/// [debounceTemp]:防抖功能(debounce)
124124
///
125125
/// [onDismiss]:在dialog被关闭的时候,该回调将会被触发
126126
///
@@ -141,7 +141,7 @@ class SmartDialog {
141141
Duration? animationDurationTemp,
142142
Color? maskColorTemp,
143143
Widget? maskWidgetTemp,
144-
bool? antiShakeTemp,
144+
bool? debounceTemp,
145145
VoidCallback? onDismiss,
146146
String? tag,
147147
bool? backDismiss,
@@ -157,7 +157,7 @@ class SmartDialog {
157157
animationDuration: animationDurationTemp ?? config.animationDuration,
158158
maskColor: maskColorTemp ?? config.maskColor,
159159
maskWidget: maskWidgetTemp ?? config.maskWidget,
160-
antiShake: antiShakeTemp ?? config.antiShake,
160+
debounce: debounceTemp ?? config.debounce,
161161
onDismiss: onDismiss,
162162
tag: tag,
163163
backDismiss: backDismiss ?? true,
@@ -191,7 +191,7 @@ class SmartDialog {
191191
///
192192
/// [maskWidgetTemp]:highly customizable mask
193193
///
194-
/// [antiShakeTemp]:anti-shake function(debounce
194+
/// [debounceTemp]debounce feature
195195
///
196196
/// [highlight]:highlight feature, dissolve the mask of a specific area
197197
///
@@ -234,7 +234,7 @@ class SmartDialog {
234234
///
235235
/// [maskWidgetTemp]:可高度定制遮罩
236236
///
237-
/// [antiShakeTemp]:防抖功能(debounce)
237+
/// [debounceTemp]:防抖功能(debounce)
238238
///
239239
/// [highlight]:高亮功能,溶解特定区域的遮罩
240240
///
@@ -262,7 +262,7 @@ class SmartDialog {
262262
Duration? animationDurationTemp,
263263
Color? maskColorTemp,
264264
Widget? maskWidgetTemp,
265-
bool? antiShakeTemp,
265+
bool? debounceTemp,
266266
Positioned? highlight,
267267
HighlightBuilder? highlightBuilder,
268268
VoidCallback? onDismiss,
@@ -284,7 +284,7 @@ class SmartDialog {
284284
animationDuration: animationDurationTemp ?? config.animationDuration,
285285
maskColor: maskColorTemp ?? config.maskColor,
286286
maskWidget: maskWidgetTemp ?? config.maskWidget,
287-
antiShake: antiShakeTemp ?? config.antiShake,
287+
debounce: debounceTemp ?? config.debounce,
288288
highlight: highlight ?? Positioned(child: Container()),
289289
highlightBuilder: highlightBuilder,
290290
onDismiss: onDismiss,
@@ -399,7 +399,7 @@ class SmartDialog {
399399
///
400400
/// [time]:toast display time on the screen(Use the 'widget' param, this param will be invalid)
401401
///
402-
/// [antiShakeTemp]:anti-shake function(debounce
402+
/// [debounceTemp]debounce feature
403403
///
404404
/// [type]:provider multiple display logic,
405405
/// please refer to [SmartToastType] comment for detailed description
@@ -428,7 +428,7 @@ class SmartDialog {
428428
///
429429
/// [time]:toast在屏幕上的显示时间
430430
///
431-
/// [antiShakeTemp]:防抖功能(debounce)
431+
/// [debounceTemp]:防抖功能(debounce)
432432
///
433433
/// [type]:提供多种显示逻辑,详细描述请查看 [SmartToastType] 注释
434434
///
@@ -444,7 +444,7 @@ class SmartDialog {
444444
Widget? maskWidgetTemp,
445445
AlignmentGeometry alignment = Alignment.bottomCenter,
446446
Duration? time,
447-
bool? antiShakeTemp,
447+
bool? debounceTemp,
448448
SmartToastType? type,
449449
Widget? widget,
450450
}) async {
@@ -457,7 +457,7 @@ class SmartDialog {
457457
maskColor: maskColorTemp ?? config.maskColor,
458458
maskWidget: maskWidgetTemp ?? config.maskWidget,
459459
time: time ?? Duration(milliseconds: 2000),
460-
antiShake: antiShakeTemp ?? config.antiShake,
460+
debounce: debounceTemp ?? config.debounce,
461461
type: type ?? SmartToastType.normal,
462462
widget: widget ?? ToastWidget(msg: msg, alignment: alignment),
463463
);

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: 3.2.3
6+
version: 3.3.0
77
homepage: https://github.com/fluttercandies/flutter_smart_dialog
88
publish_to: https://pub.dartlang.org
99

0 commit comments

Comments
 (0)