File tree Expand file tree Collapse file tree 6 files changed +24
-13
lines changed Expand file tree Collapse file tree 6 files changed +24
-13
lines changed Original file line number Diff line number Diff line change
1
+ ## [ 2.1.3] - 2020.11.13
2
+
3
+ * fixed [ #64 ] ( https://github.com/huangjianke/flutter_easyloading/issues/64 )
4
+
1
5
## [ 2.1.2] - 2020.11.12
2
6
3
7
* fixed [ #63 ] ( https://github.com/huangjianke/flutter_easyloading/issues/63 )
Original file line number Diff line number Diff line change 16
16
17
17
``` yaml
18
18
dependencies :
19
- flutter_easyloading : ^2.1.2
19
+ flutter_easyloading : ^2.1.3
20
20
` ` `
21
21
22
22
## 导入
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ Add this to your package's `pubspec.yaml` file:
16
16
17
17
``` yaml
18
18
dependencies :
19
- flutter_easyloading : ^2.1.2
19
+ flutter_easyloading : ^2.1.3
20
20
` ` `
21
21
22
22
## Import
Original file line number Diff line number Diff line change 1
- 967974c66177fcaca35ee5d47917254d
1
+ 01bf2686737ec64d54f08c343d12afd2
Original file line number Diff line number Diff line change @@ -29,12 +29,12 @@ class _TestPageState extends State<TestPage> {
29
29
30
30
void loadData () async {
31
31
try {
32
- EasyLoading .show ();
32
+ await EasyLoading .show ();
33
33
Response response = await Dio ().get ('https://github.com' );
34
34
print (response);
35
- EasyLoading .dismiss ();
35
+ await EasyLoading .dismiss ();
36
36
} catch (e) {
37
- EasyLoading .showError (e.toString ());
37
+ await EasyLoading .showError (e.toString ());
38
38
print (e);
39
39
}
40
40
}
Original file line number Diff line number Diff line change @@ -468,9 +468,7 @@ class EasyLoading {
468
468
completer: completer,
469
469
);
470
470
completer.future.whenComplete (() {
471
- for (final EasyLoadingStatusCallback callback in _statusCallbacks) {
472
- if (callback != null ) callback (EasyLoadingStatus .show);
473
- }
471
+ _callback (EasyLoadingStatus .show);
474
472
if (duration != null ) {
475
473
_cancelTimer ();
476
474
_timer = Timer .periodic (duration, (timer) async {
@@ -483,11 +481,13 @@ class EasyLoading {
483
481
return completer.future;
484
482
}
485
483
486
- Future <void > _dismiss (bool animation) {
484
+ Future <void > _dismiss (bool animation) async {
485
+ if (key != null && key.currentState == null ) {
486
+ _reset ();
487
+ return ;
488
+ }
489
+
487
490
return key? .currentState? .dismiss (animation)? .whenComplete (() {
488
- for (final EasyLoadingStatusCallback callback in _statusCallbacks) {
489
- if (callback != null ) callback (EasyLoadingStatus .dismiss);
490
- }
491
491
_reset ();
492
492
});
493
493
}
@@ -498,6 +498,13 @@ class EasyLoading {
498
498
_progressKey = null ;
499
499
_cancelTimer ();
500
500
_markNeedsBuild ();
501
+ _callback (EasyLoadingStatus .dismiss);
502
+ }
503
+
504
+ void _callback (EasyLoadingStatus status) {
505
+ for (final EasyLoadingStatusCallback callback in _statusCallbacks) {
506
+ if (callback != null ) callback (status);
507
+ }
501
508
}
502
509
503
510
void _markNeedsBuild () {
You can’t perform that action at this time.
0 commit comments