Flutter: Disable Swipe to Navigate Back in iOS

后端 未结 7 1104
一向
一向 2020-12-16 15:25

I\'m new to flutter development, and find it a bit frustrating in iOS when you have a navigation drawer and when you swipe to open it, it\'ll perform a Navigation.of(c

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 15:50

    Alright, so as @Darky said WillPopScope is a perfectly acceptable answer, however, if you want to disable it across the board you can actually do the following.

    Open your project in xcode, find AppDelegate.swift and add the following:

    let controller: FlutterViewController
        = window?.rootViewController as! FlutterViewController;
    controller.navigationController?
        .interactivePopGestureRecognizer?.isEnabled = false;
    

提交回复
热议问题