@@ -372,11 +372,29 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
372
372
builder: (context, constraints) {
373
373
final cacheExtent = _cacheExtent (constraints);
374
374
return Listener (
375
+ onPointerDown: (event) {
376
+ // here we're checking if it's tap by touchscreen
377
+ _isTouchScreen = event.kind == PointerDeviceKind .touch ||
378
+ event.kind == PointerDeviceKind .trackpad;
379
+ },
375
380
onPointerMove: (event) {
376
- _isTouchScreen = event.kind == PointerDeviceKind .touch || event.kind == PointerDeviceKind .trackpad;
381
+ // onPointerMove triggers when finger are dragging to scroll
382
+ _isTouchScreen = event.kind == PointerDeviceKind .touch ||
383
+ event.kind == PointerDeviceKind .trackpad;
377
384
},
378
385
onPointerHover: (event) {
379
- _isTouchScreen = event.kind == PointerDeviceKind .touch || event.kind == PointerDeviceKind .trackpad;
386
+ _isTouchScreen = event.kind == PointerDeviceKind .touch ||
387
+ event.kind == PointerDeviceKind .trackpad;
388
+ },
389
+ onPointerPanZoomStart: (event) {
390
+ // onPointerPanZoomStart triggers when scrolling by touchpad
391
+ _isTouchScreen = event.kind == PointerDeviceKind .touch ||
392
+ event.kind == PointerDeviceKind .trackpad;
393
+ },
394
+ onPointerSignal: (event) {
395
+ if (event is PointerScrollEvent ) {
396
+ _isTouchScreen = event.kind != PointerDeviceKind .mouse;
397
+ }
380
398
},
381
399
child: GestureDetector (
382
400
onPanDown: (_) => _stopScroll (canceled: true ),
0 commit comments