So when I set physics: const NeverScrollableScrollPhysics()
on ListView.builder
, it also disables mouse wheel scrolling. Is there a way to keep mouse wheel but disable drag?
Thanks
[Solution] How to Get My Mouse to Stop Scrolling 1 Press Win + I at the same time to open the Windows Settings interface. 2 Navigate to Devices > Mouse. 3 Disable the option of Scroll inactive windows when I hover over them. See More....
The scroll button of a mouse can be used to scroll through a long document or webpage. Also, during a game, it can be used as a third button. However, the mouse scroll doesn’t always work well and you may encounter some issues. In our previous post - What to Do If Your Mouse Scroll Wheel Jumps in Windows 10, we show the issue of scroll jumping.
This is a useful solution to fix the Windows 10 scrolling bug. Just follow these steps below: Step 1: Press Win + I at the same time to open the Windows Settings interface. Step 2: Navigate to Devices > Mouse. Step 3: Disable the option of Scroll inactive windows when I hover over them.
When the scroll button starts infinite scrolling, you cannot use the mouse properly. But don’t worry and this is mainly caused by the setting issues. You can easily fix the Windows 10 uncontrollable scrolling.
Thanks for the answer (@HasilT), it helped! I found that PointerScrollEvent.scrollDelta
is already "animated", and you can use it with ScrollController.jumpTo
. In my code, I prevent overscroll with min
and max
functions.
import 'dart:math' as math;
Listener(
onPointerSignal: (ps) {
if (ps is PointerScrollEvent) {
final newOffset = _controller.offset + ps.scrollDelta.dy;
if (ps.scrollDelta.dy.isNegative) {
_controller.jumpTo(math.max(0, newOffset));
} else {
_controller
.jumpTo(math.min(_controller.position.maxScrollExtent, newOffset));
}
}
},
child: ListView.builder(
itemCount: 100,
controller: _controller,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return Container(
height: 100,
margin: EdgeInsets.all(10),
color: index.isEven ? Colors.blue : Colors.green);
},
),
);
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