Flutter: ListView disable scrolling with touchscreen

Inside ListView widget, use

physics: const NeverScrollableScrollPhysics()

As mentioned in the comments, the NeverScrollableScrollPhysics class will do this:

NeverScrollableScrollPhysics class

Scroll physics that does not allow the user to scroll.


You may add just primary: false inside your ListView Widget

Defaults to matching platform conventions. Furthermore, if the primary is false, then the user cannot scroll if there is insufficient content to scroll, while if the primary is true, they can always attempt to scroll.

For more, check out Official Doc


Conditional statement for enable and disable scrollview.

physics: chckSwitch ? const  NeverScrollableScrollPhysics() : const AlwaysScrollableScrollPhysics(),

Tags:

Dart

Flutter