@@ -442,11 +442,29 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
442
442
builder: (context, constraints) {
443
443
final cacheExtent = _cacheExtent (constraints);
444
444
return Listener (
445
+ onPointerDown: (event) {
446
+ // here we're checking if it's tap by touchscreen
447
+ _isTouchScreen = event.kind == PointerDeviceKind .touch ||
448
+ event.kind == PointerDeviceKind .trackpad;
449
+ },
445
450
onPointerMove: (event) {
446
- _isTouchScreen = event.kind == PointerDeviceKind .touch || event.kind == PointerDeviceKind .trackpad;
451
+ // onPointerMove triggers when finger are dragging to scroll
452
+ _isTouchScreen = event.kind == PointerDeviceKind .touch ||
453
+ event.kind == PointerDeviceKind .trackpad;
447
454
},
448
455
onPointerHover: (event) {
449
- _isTouchScreen = event.kind == PointerDeviceKind .touch || event.kind == PointerDeviceKind .trackpad;
456
+ _isTouchScreen = event.kind == PointerDeviceKind .touch ||
457
+ event.kind == PointerDeviceKind .trackpad;
458
+ },
459
+ onPointerPanZoomStart: (event) {
460
+ // onPointerPanZoomStart triggers when scrolling by touchpad
461
+ _isTouchScreen = event.kind == PointerDeviceKind .touch ||
462
+ event.kind == PointerDeviceKind .trackpad;
463
+ },
464
+ onPointerSignal: (event) {
465
+ if (event is PointerScrollEvent ) {
466
+ _isTouchScreen = event.kind != PointerDeviceKind .mouse;
467
+ }
450
468
},
451
469
child: GestureDetector (
452
470
onPanDown: (_) => _stopScroll (canceled: true ),
0 commit comments