Unable to scroll diagonally with a trackpad in a TwoDimensionalScrollView
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
### Steps to reproduce
1. Build the example application from the ["2D scrolling - Flutter Build Show"](https://www.youtube.com/watch?v=ppEdTo-VGcg).
2. Try scrolling diagonally using a trackpad.
### Expected results
I would expect the viewport to change offset in both axes simultaneously.
### Actual results
The viewport changes its offset in a single axis only.
### Code sample
Code sample
[DartPad - Two Dimensional Grid in Flutter](https://dartpad.dev/?id=4424936c57ed13093eb389123383e894)
You can additionaly wrap the scroll view in a [Listener](https://api.flutter.dev/flutter/widgets/Listener-class.html) to make sure the scroll events have offset in both axes.
```dart
...
body: Listener(
onPointerSignal: (PointerSignalEvent signal) {
if (signal is PointerScrollEvent) {
print(signal.scrollDelta);
}
},
child: TwoDimensionalGridView(
...
```
Output sample:
```console
flutter: Offset(-7.8, -14.4)
flutter: Offset(-6.1, -14.4)
flutter: Offset(-7.0, -14.4)
flutter: Offset(-6.1, -14.4)
```
### Screenshots or Video
Screenshots / Video demonstration
Diagonal drag scrolling works as expected:

Diagonal pointer scrolls are not applied on both axes at the same time:

### Logs
_No response_
### Flutter Doctor output
Doctor output
```console
[✓] Flutter (Channel stable, 3.24.5, on Fedora Linux 41 (Workstation Edition) 6.11.7-300.fc41.x86_64, locale
en_US.UTF-8)
• Flutter version 3.24.5 on channel stable at /home/kamil/.local/apps/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision dec2ee5c1f (7 days ago), 2024-11-13 11:13:06 -0800
• Engine revision a18df97ca5
• Dart version 3.5.4
• DevTools version 2.37.3
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/to/linux-android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = /usr/bin/brave-browser-stable
[✓] Linux toolchain - develop for Linux desktop
• clang version 19.1.0 (Fedora 19.1.0-1.fc41)
• cmake version 3.30.5
• ninja version 1.12.1
• pkg-config version 2.3.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/to/linux-android-setup for detailed instructions).
[✓] VS Code (version 1.95.3)
• VS Code at /usr/share/code
• Flutter extension version 3.100.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Fedora Linux 41 (Workstation Edition) 6.11.7-300.fc41.x86_64
• Chrome (web) • chrome • web-javascript • Brave Browser 131.1.73.89
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.
```
Contributor guide
Assessment
This issue has not been assessed yet.