I'm trying to implement Smooth Scroll in a PageView, so I have set the physics
property to NeverScrollableScrollPhysics()
and I have wrapped the items in the builder fonction with a GestureDetector
that detects Drag gestures.
When a drag gesture is detected, a function is triggered and the page will be change accordingly.
My problem is that on Flutter Web, the onVerticalDragGesture
is only detected when dragging with three fingers, and nothing happens when swiping with two. Is there any way to solve this?
By the way, the result is the same with the onPanUpdate
property.
Feel free to suggest other ways to implement Smooth Scroll. Thanks in advance, guys.
Here is my code if you want to reproduce it:
PageView.builder(
physics: NeverScrollableScrollPhysics(),
controller: /* PAGECONTROLLER */,
scrollDirection: Axis.vertical,
pageSnapping: false,
itemBuilder: (context, index) {
return GestureDetector(
onVerticalDragUpdate: (DragUpdateDetails details) {
if (details.delta.dy > 5.0) {
/* FUNCTION TO MOVE TO PREVIOUS PAGE */
}
if (details.delta.dy < -5.0) {
/* FUNCTION TO MOVE TO NEXT PAGE */
}
},
child: /* PAGES OF THE PAGEVIEW, JUST USE EMPTY CONTAINERS WITH DIFFERENT COLORS */,
);
},
itemCount: /* NUMBER OF PAGES */,
),
PanGestureRecognizer
doesn't have aremovePointer
method, ornumberOfPointers
. – Aecium