setNavigatorKey method
设置 Navigator key 以支持自动导航处理
通过设置 NavigatorKey,插件可以在检测到左滑返回手势时自动调用 maybePop()。
参数:
navigatorKey: 全局 Navigator KeyautoHandle: 是否自动处理导航,默认为 true
Implementation
@override
void setNavigatorKey(
GlobalKey<NavigatorState>? navigatorKey, {
bool autoHandle = true,
}) {
_ensureHandlerInitialized();
_navigatorKey = navigatorKey;
_autoHandleNavigation = autoHandle;
// 当设置 Navigator Key 时,启用 iOS 端的手势拦截
_enableIosGestureIfNeeded();
}