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?
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.
By default, the PageView comes with a horizontal scroll for the pages. You can change the scroll direction using the Axis property.
You can use the following code in your singleChildScrollView. physics: NeverScrollableScrollPhysics(), It stops it from being able to scroll.
To disable swiping you can set:
PageView(physics: NeverScrollableScrollPhysics())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With