-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS gesture down OtherViewController to FlutterViewController #35784
Comments
Hi @helang1991, can you post a reproduction of the issue as well as the output of |
Hi @Piinks ,I clicked screen in other viewController by plugin, why the FlutterViewController received gesture events? Maybe other developers made similar issue. |
I also met the problem, from the beginning, I want to develop a customized camera, a new plugin is developed to achieve this, the customized camera is a native page, when I open the camera page from flutter button, then there are two pages in app, foreground native camera page and background flutter page, something bad happened here were that when I click on the native camera page, the background futter page can receive the click event, eg. some button can react to these events. Til now, I found the issue can be reproduced only in ios platform, android works well. I found that image_picker have the same issue, please refer this link below: Further more, to find the root cause, I replace the camera native page with one common native page of ios, this issue can be produced too |
Any update on this issue? @Piinks Piinks |
I encountered the same problem. Here is my investigation and current workaround. Sample applicationhttps://github.com/maeharin/flutter_ios_present_sample ScreenshotWhy this occuredLooking at the implementation of FlutterViewController (ex: engine v1.5.4-hotfixes branch), we can see they are overriding 4 methods(such as the touchesBegan). From here, the iOS touch event is propagated to the Flutter side See the apple documentation below for how to call touchesBegan. Touch events on the iOS side are designed to run up the Responder Chain In our case, Responder Chain is like this
WorkaroundThe following workarounds can be considered 1. Override 4 methods of UIViewController that is presented from FlutterViewControllerThis prevents propagating unhandled events to FlutterViewController override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {}
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {} 2. Stop doing present from FlutterViewControllerDo not present() the UIViewController directly from the FlutterViewController, for example, by making the iOS side rootViewController a NavigationController instead of a FlutterViewController. https://medium.com/@najeira/change-ios-rootviewcontroller-with-flutter-fc4234f37105 |
Thanks for your advice, I'll try your methods to fix it |
Hi @helang1991 |
Without additional information we are unfortunately not sure how to resolve this issue. Could everyone who still has this problem please file a new issue with the exact description of what happens, logs and the output of |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to Reproduce
I wanna jump to other viewController by Plugin in Flutter, however, i met a problem: the FlutterViewController can receive gesture events from other viewController.
this is my demo link: https://github.com/helang1991/flutter_iOS_gesture_demo
screenshot:
Logs
The text was updated successfully, but these errors were encountered: