This code uses a GestureDetector widget to detect horizontal drag gestures and trigger events based on the direction of the drag. However, the GestureDetector widget is nested within the SideMenu widget, which is likely responsible for the scrolling behavior. As a result, when the user swipes up or down to scroll the screen, the GestureDetector widget is also triggered, potentially leading to unintended behavior. To prevent this, the GestureDetector widget should be moved to a higher level in the widget tree so that it is not affected by scrolling gestures.

Flutter GestureDetector 导致上下滑动切换页面的问题及解决方法

原文地址: https://www.cveoy.top/t/topic/obS4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录