I have a scrollable widget, say a ListView, which contains some special widget.
How can I prevent the scrollable to scroll when the user tries to scroll by starting to scroll on top of that widget?
In other words, I want that widget to be like a "hole" that prevents the scrollable to sense gestures there.
Flutter ListView – Never Scrollable You can make the ListView widget never scrollable by setting physics property to NeverScrollableScrollPhysics().
Use physics: const NeverScrollableScrollPhysics() in Listview Then you can prevent your widget from beeing scrolled.
You can provide physics: NeverScrollableScrollPhysics() on GridView to disable scroll effect. If you want scrollable as secondary widget use primary: false, To have Full Page scrollable, you can use body:SingleChildScrollView(..) or better using body:CustomScrollView(..) Save this answer.
You need to add a padding to your ListView in order to offset the scroll boundary into the screen.
Wrap the widget with GestureDetector
and implement empty gesture functions in it.
GestureDetector(
onVerticalDragUpdate: (_) {},
child: YourWidget
),
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