Skip to content

Commit

Permalink
process #135
Browse files Browse the repository at this point in the history
  • Loading branch information
xdd666t committed Jun 11, 2023
1 parent abfc0a9 commit d83e257
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# [4.9.1]
# [4.9.x]
* fix [#132](https://github.com/fluttercandies/flutter_smart_dialog/issues/132)
* optimize nonAnimationTypes
* toast add some param
* fix [#135](https://github.com/fluttercandies/flutter_smart_dialog/issues/135)

# [4.9.0]
* Breaking Change
Expand Down
21 changes: 18 additions & 3 deletions lib/src/init_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,16 @@ class _FlutterSmartDialogState extends State<FlutterSmartDialog> {
void initState() {
ViewUtils.addSafeUse(() {
try {
var navigator = widget.child as Navigator;
var key = navigator.key as GlobalKey;
DialogProxy.contextNavigator = key.currentContext;
BuildContext? context;
if (widget.child is Navigator) {
context = getNavigatorContext(widget.child as Navigator);
} else if (widget.child is FocusScope) {
var focusScope = widget.child as FocusScope;
if (focusScope.child is Navigator) {
context = getNavigatorContext(focusScope.child as Navigator);
}
}
DialogProxy.contextNavigator = context;
} catch (_) {}
});

Expand Down Expand Up @@ -207,4 +214,12 @@ class _FlutterSmartDialogState extends State<FlutterSmartDialog> {
]),
);
}

BuildContext? getNavigatorContext(Navigator navigator) {
BuildContext? context;
if (navigator.key is GlobalKey) {
context = (navigator.key as GlobalKey).currentContext;
}
return context;
}
}
4 changes: 2 additions & 2 deletions macos/Flutter/ephemeral/Flutter-Generated.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FLUTTER_ROOT=/Users/xdd666/Develop/SDK/flutter_sdk
FLUTTER_APPLICATION_PATH=/Users/xdd666/Develop/Github/flutter_smart_dialog
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=4.9.1
FLUTTER_BUILD_NUMBER=4.9.1
FLUTTER_BUILD_NAME=4.9.2
FLUTTER_BUILD_NUMBER=4.9.2
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false
Expand Down
4 changes: 2 additions & 2 deletions macos/Flutter/ephemeral/flutter_export_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export "FLUTTER_ROOT=/Users/xdd666/Develop/SDK/flutter_sdk"
export "FLUTTER_APPLICATION_PATH=/Users/xdd666/Develop/Github/flutter_smart_dialog"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=4.9.1"
export "FLUTTER_BUILD_NUMBER=4.9.1"
export "FLUTTER_BUILD_NAME=4.9.2"
export "FLUTTER_BUILD_NUMBER=4.9.2"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description:
An elegant Flutter Dialog solution,
Easily implement Toast, Loading and custom Dialog,
Make the use of the dialog easier!
version: 4.9.1+1
version: 4.9.2
homepage: https://github.com/fluttercandies/flutter_smart_dialog
# flutter pub publish --server=https://pub.dartlang.org

Expand Down

0 comments on commit d83e257

Please sign in to comment.