diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ba6353..f08d6b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## [4.6.9] + * fix close ignored when not inited ## [4.6.8] * fix loading close error ## [4.6.6] diff --git a/lib/src/controller.dart b/lib/src/controller.dart index 4df74f3..7028c96 100644 --- a/lib/src/controller.dart +++ b/lib/src/controller.dart @@ -15,6 +15,7 @@ abstract class DialogController extends ChangeNotifier bool get isClose; bool _isClosed = false; + bool get isClosed => _isClosed; AnimationConfig animate; AnimationConfig leaveAnimate; @@ -29,13 +30,17 @@ abstract class DialogController extends ChangeNotifier AnimationConfig.fadeAndZoomOut; void open(); - void close(); + + @mustCallSuper + void close() { + _isClosed = true; + } + void remove(); set value(v) { _value = v; if (_isClosed) return; - _isClosed = isClose; notifyListeners(); if (isClose) { close(); @@ -75,6 +80,7 @@ abstract class OverlayController extends DialogController { @override void open() { + if (isClosed) return; entry ??= OverlayEntry( builder: (BuildContext context) { final animateChild = CombinedAnimation( @@ -98,7 +104,11 @@ abstract class OverlayController extends DialogController { @override void close() { - if (!controller.isLeaved) { + super.close(); + + if (!controller.isEntered) { + remove(); + } else if (!controller.isLeaved) { controller.leave(); } } diff --git a/pubspec.yaml b/pubspec.yaml index 0add810..7e79705 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: shirne_dialog description: A flutter package to use alert, toast, popup, snack, imagePreview, loading etc. with customizable style in anywhere. -version: 4.6.8 +version: 4.6.9 homepage: https://shirne.github.io/dialog/ repository: https://github.com/shirne/shirne_dialog screenshots: