Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PageView: Disable the default scrolling and replace it with Tap event

Tags:

flutter

dart

If I have a PageView, how can I disable the default scroll behavior (swiping) and make it such that the next item is scrolled into view by tapping on a button instead?

like image 828
Shady Aziza Avatar asked Dec 31 '17 16:12

Shady Aziza


People also ask

How do I disable PageView scrolling?

You may come across cases like where you need to disable swipe or scrolling for your Scrolling widgets (ListView, PageView etc). You can simply achieve this by setting physics to NeverScrollableScrollPhysics.

What is the default scroll of PageView?

By default, the PageView comes with a horizontal scroll for the pages. You can change the scroll direction using the Axis property.

How do I turn off singleChildScrollView flutter?

You can use the following code in your singleChildScrollView. physics: NeverScrollableScrollPhysics(), It stops it from being able to scroll.


1 Answers

To disable swiping you can set:

PageView(physics: NeverScrollableScrollPhysics()) 
like image 129
Christopher Thompson Avatar answered Sep 27 '22 22:09

Christopher Thompson