Skip to content

Commit 43f2a0e

Browse files
committed
update v2.1.3 (fixed: #64)
1 parent 930b9f6 commit 43f2a0e

File tree

6 files changed

+24
-13
lines changed

6 files changed

+24
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [2.1.3] - 2020.11.13
2+
3+
* fixed [#64](https://github.com/huangjianke/flutter_easyloading/issues/64)
4+
15
## [2.1.2] - 2020.11.12
26

37
* fixed [#63](https://github.com/huangjianke/flutter_easyloading/issues/63)

README-zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
```yaml
1818
dependencies:
19-
flutter_easyloading: ^2.1.2
19+
flutter_easyloading: ^2.1.3
2020
```
2121
2222
## 导入

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Add this to your package's `pubspec.yaml` file:
1616

1717
```yaml
1818
dependencies:
19-
flutter_easyloading: ^2.1.2
19+
flutter_easyloading: ^2.1.3
2020
```
2121
2222
## Import

example/ios/Flutter/.last_build_id

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
967974c66177fcaca35ee5d47917254d
1+
01bf2686737ec64d54f08c343d12afd2

example/lib/test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ class _TestPageState extends State<TestPage> {
2929

3030
void loadData() async {
3131
try {
32-
EasyLoading.show();
32+
await EasyLoading.show();
3333
Response response = await Dio().get('https://github.com');
3434
print(response);
35-
EasyLoading.dismiss();
35+
await EasyLoading.dismiss();
3636
} catch (e) {
37-
EasyLoading.showError(e.toString());
37+
await EasyLoading.showError(e.toString());
3838
print(e);
3939
}
4040
}

lib/src/easy_loading.dart

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,7 @@ class EasyLoading {
468468
completer: completer,
469469
);
470470
completer.future.whenComplete(() {
471-
for (final EasyLoadingStatusCallback callback in _statusCallbacks) {
472-
if (callback != null) callback(EasyLoadingStatus.show);
473-
}
471+
_callback(EasyLoadingStatus.show);
474472
if (duration != null) {
475473
_cancelTimer();
476474
_timer = Timer.periodic(duration, (timer) async {
@@ -483,11 +481,13 @@ class EasyLoading {
483481
return completer.future;
484482
}
485483

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+
487490
return key?.currentState?.dismiss(animation)?.whenComplete(() {
488-
for (final EasyLoadingStatusCallback callback in _statusCallbacks) {
489-
if (callback != null) callback(EasyLoadingStatus.dismiss);
490-
}
491491
_reset();
492492
});
493493
}
@@ -498,6 +498,13 @@ class EasyLoading {
498498
_progressKey = null;
499499
_cancelTimer();
500500
_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+
}
501508
}
502509

503510
void _markNeedsBuild() {

0 commit comments

Comments
 (0)