File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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+
15## [ 2.1.2] - 2020.11.12
26
37* fixed [ #63 ] ( https://github.com/huangjianke/flutter_easyloading/issues/63 )
Original file line number Diff line number Diff line change 1616
1717``` yaml
1818dependencies :
19- flutter_easyloading : ^2.1.2
19+ flutter_easyloading : ^2.1.3
2020` ` `
2121
2222## 导入
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ Add this to your package's `pubspec.yaml` file:
1616
1717``` yaml
1818dependencies :
19- flutter_easyloading : ^2.1.2
19+ flutter_easyloading : ^2.1.3
2020` ` `
2121
2222## 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> {
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 }
Original file line number Diff line number Diff 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 () {
You can’t perform that action at this time.
0 commit comments