使用我的代码:
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)
答案 0 :(得分:2)
使用remove
中的OverlayEntry
final customOverlay = new CustomOverlay();
final overlayEntry = OverlayEntry(builder: (BuildContext context) { return customOverlay; }));
overlayEntry.remove();