[web] Notify engine of handled PointerScrollEvents. (#145500)

Notifies the engine when `PointerSignalEvents` have been ignored by the framework, through the `ui.PointerData.respond` method.

This allows the web to "preventDefault" (or not) on `wheel` events.

## Issues

* Fixes (partially): https://github.com/flutter/flutter/issues/139263

## Tests

* Added tests to ensure `respond` is called at the right time, with the right value.

## Demo

* https://dit-multiview-scroll.web.app

<details>
<summary>

## Previous versions

</summary>

1. Modified `PointerScrollEvent`, not shippable.
2. Modified when events were handled, instead of the opposite.

</details>
This commit is contained in:
David Iglesias
2024-06-10 10:52:58 -07:00
committed by GitHub
parent 5efb67b7c1
commit 0c2ee845fc
7 changed files with 130 additions and 4 deletions

View File

@@ -288,6 +288,7 @@ class TestPointer {
PointerScrollEvent scroll(
Offset scrollDelta, {
Duration timeStamp = Duration.zero,
RespondPointerEventCallback? onRespond,
}) {
assert(kind != PointerDeviceKind.touch, "Touch pointers can't generate pointer signal events");
assert(location != null);
@@ -297,6 +298,7 @@ class TestPointer {
device: _device,
position: location!,
scrollDelta: scrollDelta,
onRespond: onRespond,
);
}