Expose GestureBinding.handlePointerEvent, replacing dispatchEvent as the preferred way to dispatch events (#64846)

This commit is contained in:
Tong Mu
2020-09-15 22:17:06 -07:00
committed by GitHub
parent ea039ed3f9
commit a48e14308e
16 changed files with 219 additions and 229 deletions

View File

@@ -596,17 +596,14 @@ class FlutterDriverExtension with DeserializeFinderFactory {
final Offset startLocation = _prober.getCenter(target);
Offset currentLocation = startLocation;
final TestPointer pointer = TestPointer(1);
final HitTestResult hitTest = HitTestResult();
_prober.binding.hitTest(hitTest, startLocation);
_prober.binding.dispatchEvent(pointer.down(startLocation), hitTest);
_prober.binding.handlePointerEvent(pointer.down(startLocation));
await Future<void>.value(); // so that down and move don't happen in the same microtask
for (int moves = 0; moves < totalMoves; moves += 1) {
currentLocation = currentLocation + delta;
_prober.binding.dispatchEvent(pointer.move(currentLocation), hitTest);
_prober.binding.handlePointerEvent(pointer.move(currentLocation));
await Future<void>.delayed(pause);
}
_prober.binding.dispatchEvent(pointer.up(), hitTest);
_prober.binding.handlePointerEvent(pointer.up());
return const ScrollResult();
}