diff --git a/CHANGELOG.md b/CHANGELOG.md index 25bcfcc..50056c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * optimize loading [#137](https://github.com/fluttercandies/flutter_smart_dialog/issues/137) * optimize 'show debug point' * fix [#142](https://github.com/fluttercandies/flutter_smart_dialog/issues/142) +* add checkExist # [4.9.0] diff --git a/lib/src/config/smart_config.dart b/lib/src/config/smart_config.dart index b95619a..e7c4934 100644 --- a/lib/src/config/smart_config.dart +++ b/lib/src/config/smart_config.dart @@ -41,6 +41,7 @@ class SmartConfig { Set dialogTypes = const { SmartAllDialogType.custom, SmartAllDialogType.attach, + SmartAllDialogType.loading, }, }) { return DialogKit.instance.checkExist(tag: tag, dialogTypes: dialogTypes); diff --git a/lib/src/custom/custom_dialog.dart b/lib/src/custom/custom_dialog.dart index 38f6e9a..7005a2d 100644 --- a/lib/src/custom/custom_dialog.dart +++ b/lib/src/custom/custom_dialog.dart @@ -14,8 +14,8 @@ import '../config/enum_config.dart'; import '../data/animation_param.dart'; import '../data/base_dialog.dart'; import '../data/notify_info.dart'; -import '../kit/debounce_utils.dart'; import '../smart_dialog.dart'; +import '../kit/debounce_utils.dart'; import '../widget/helper/smart_overlay_entry.dart'; ///main function : custom dialog diff --git a/lib/src/custom/custom_notify.dart b/lib/src/custom/custom_notify.dart index 7808d52..8d621e8 100644 --- a/lib/src/custom/custom_notify.dart +++ b/lib/src/custom/custom_notify.dart @@ -10,8 +10,8 @@ import '../config/enum_config.dart'; import '../data/animation_param.dart'; import '../data/base_dialog.dart'; import '../data/notify_info.dart'; -import '../kit/debounce_utils.dart'; import '../smart_dialog.dart'; +import '../kit/debounce_utils.dart'; import '../widget/helper/smart_overlay_entry.dart'; ///main function : notify dialog diff --git a/lib/src/helper/dialog_proxy.dart b/lib/src/helper/dialog_proxy.dart index 427f669..2e6e864 100644 --- a/lib/src/helper/dialog_proxy.dart +++ b/lib/src/helper/dialog_proxy.dart @@ -345,7 +345,7 @@ class DialogProxy { CloseType closeType = CloseType.normal, }) { if (status == SmartStatus.smart) { - var loading = config.isExistLoading; + var loading = config.loading.isExist; if (loading && (tag == null || (dialogQueue.isEmpty && notifyQueue.isEmpty))) { diff --git a/lib/src/helper/navigator_observer.dart b/lib/src/helper/navigator_observer.dart index 2b8a552..29de727 100644 --- a/lib/src/helper/navigator_observer.dart +++ b/lib/src/helper/navigator_observer.dart @@ -25,12 +25,16 @@ class SmartNavigatorObserver extends NavigatorObserver { RouteRecord.curRoute = previousRoute; RouteRecord.instance.pop(route, previousRoute); - if (!SmartDialog.config.isExist || - route.settings.name == SmartTag.systemDialog) { + var checkDialog = SmartDialog.config.checkExist(dialogTypes: { + SmartAllDialogType.custom, + SmartAllDialogType.attach, + SmartAllDialogType.loading, + }); + if (!checkDialog || route.settings.name == SmartTag.systemDialog) { return; } - if (SmartDialog.config.isExistLoading) { + if (SmartDialog.config.loading.isExist) { DialogProxy.instance.dismiss( status: SmartStatus.loading, closeType: CloseType.route, diff --git a/lib/src/helper/pop_monitor/boost_route_monitor.dart b/lib/src/helper/pop_monitor/boost_route_monitor.dart index aadc82b..658e80f 100644 --- a/lib/src/helper/pop_monitor/boost_route_monitor.dart +++ b/lib/src/helper/pop_monitor/boost_route_monitor.dart @@ -54,7 +54,7 @@ class BoostRouteMonitor { bool shouldHandle = false; try { //handle loading - if (SmartDialog.config.isExistLoading) { + if (SmartDialog.config.loading.isExist) { return true; } diff --git a/lib/src/helper/pop_monitor/monitor_pop_route.dart b/lib/src/helper/pop_monitor/monitor_pop_route.dart index 23bb2fd..94e6a8f 100644 --- a/lib/src/helper/pop_monitor/monitor_pop_route.dart +++ b/lib/src/helper/pop_monitor/monitor_pop_route.dart @@ -22,7 +22,7 @@ class MonitorPopRoute with WidgetsBindingObserver { @override Future didPopRoute() async { //loading - if (SmartDialog.config.isExistLoading) { + if (SmartDialog.config.loading.isExist) { DialogProxy.instance.dismiss( status: SmartStatus.loading, closeType: CloseType.back, diff --git a/lib/src/smart_dialog.dart b/lib/src/smart_dialog.dart index ddb3627..141c714 100644 --- a/lib/src/smart_dialog.dart +++ b/lib/src/smart_dialog.dart @@ -16,6 +16,7 @@ class SmartDialog { /// Compatible with older versions /// /// 兼容老版本 + @Deprecated("5.0 will be deleted and is not recommended for continued use") static CompatibleSmartDialog compatible = CompatibleSmartDialog.instance; /// SmartDialog global config diff --git a/pubspec.yaml b/pubspec.yaml index 5ac2bbd..df13c5a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ homepage: https://github.com/fluttercandies/flutter_smart_dialog # flutter pub publish --server=https://pub.dartlang.org environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.12.0 <4.0.0' flutter: ">=3.0.0" dependencies: