gpt4 book ai didi

flutter - 如何关闭 Navigator.of(context).overlay

转载 作者:IT王子 更新时间:2023-10-29 06:40:04 25 4
gpt4 key购买 nike

用我的代码:

final CustomOverlay customOverlay = new CustomOverlay(); 
Navigator.of(context).overlay.insert(OverlayEntry(builder: (BuildContext context) { return customOverlay; }));

但是当我想关闭那个 customOverlay 但我不知道如何......

我尝试了 Navigator.of(context).overlay.dispose();

但这行不通....

[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.6 17G4015, locale en-NL)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
✗ Verify that all connected devices have been paired with this computer in Xcode.
If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
To update with Brew, run:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
[✓] Android Studio (version 3.3)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.
Macbooks-MacBook-Pro:TweensTalent-Front-end daniquedejong$ flutter doctor -v
[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.6 17G4015, locale en-NL)
• Flutter version 1.0.0 at /Users/daniquedejong/tools/flutter
• Framework revision [5391447](https://github.com/flutter/flutter/commit/5391447fae6209bb21a89e6a5a6583cac1af9b4b) (3 months ago), 2018-11-29 19:41:26 -0800
• Engine revision [7375a0f](https://github.com/flutter/flutter/commit/7375a0f414bde4bc941e623482221db2fc8c4ab5)
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at /Users/daniquedejong/Library/Android/sdk
• Android NDK at /Users/daniquedejong/Library/Android/sdk/ndk-bundle
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.

[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
✗ Verify that all connected devices have been paired with this computer in Xcode.
If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
To update with Brew, run:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
• ios-deploy 2.0.0
• CocoaPods version 1.5.3

[✓] Android Studio (version 3.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 32.0.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

最佳答案

使用 remove 从你的 OverlayEntry

final customOverlay = new CustomOverlay(); 
final overlayEntry = OverlayEntry(builder: (BuildContext context) { return customOverlay; }));
overlayEntry.remove();

关于flutter - 如何关闭 Navigator.of(context).overlay,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54903690/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com