Repository: flutter
Issue: [Web] [iOS] Pan gestures broken after initial pinch gesture
Labels: framework,f: gestures,platform-web,has reproducible steps,P2,browser: safari-ios,found in release: 3.3,found in release: 3.4,team-web,triaged-web

When using a Flutter Web-App on iPad using Safari or Chrome browser, gesture detection of pan gestures gets broken after initial pinch (zoom) gesture (performed as first gesture after app start).

It seems to be important that the very first gesture gets detected as pinch gesture (two fingers). If the very first gesture is a pan gesture (one finger only) the issue does not occur afterwards. You have to reload the page and try again in this case.

Tested + confirmed on: 
* iPad Pro (12.9", Gen 4) running iOS 15.6.1, using Safari + Google Chrome (reproducible 9/10 times)
* iPhone 12 Pro running iOS 15.6 using Safari (harder to reproduce here, took me 2-3 tries maybe due to smaller screen)

## Steps to Reproduce

The issue can be reproduced e.g. with InteractiveViewer builder example:

1. Build InteractiveViewer example

```
flutter create --sample=widgets.InteractiveViewer.builder.1 viewer_test
cd viewer_test
flutter build web --web-renderer canvaskit
```

2. Launch local webserver to host the app, e.g. using python:

```
cd build/web
python -m http.server 80
```

3. Open the web app on iPad using Safari

4. After app has loaded, perform a **pinch zoom** gesture (using two fingers) as the **very first interaction** with the app

5. Perform pan/move gesture (using one finger)

**Expected results:**

Zoom in/out and moving of the displayed grid as usual

**Actual results:**

After initial zooming the displayed grid, normal pan/move gestures are broken in 9/10 times. Panning with one finger seems to act like zooming, like there is still a second finger present on the screen.

**Video:**

https://user-images.githubusercontent.com/21358685/189883833-75aeb7b3-c640-48f2-a658-b61d632ec948.mp4


## Logging of pointerCount

I added some handlers to the InteractiveViewer to output the pointerCount:

```
        child: InteractiveViewer(
          onInteractionStart: ((details) {
            print("onInteractionStart: pointerCount = ${details.pointerCount}");
          }),
          onInteractionUpdate: ((details) {
            print(
              "onInteractionUpdate: pointerCount = ${details.pointerCount}",
            );
          }),
          onInteractionEnd: ((details) {
            print("onInteractionEnd: pointerCount = ${details.pointerCount}");
          }),
          ...
```

### Broken scenario (Video: 0:00 - 0:20)

Here is the output when the gesture detector gets broken after initial pinch/zoom gesture:

1. Pinch/zoom (as very first gesture after app load)
```
[Log] onInteractionStart: pointerCount = 2 (main.dart.js, line 14198)
[Log] onInteractionUpdate: pointerCount = 2 (main.dart.js, line 14198, x46)
...
[Log] onInteractionEnd: pointerCount = 1 (main.dart.js, line 14198)
```

**[X] This is wrong!** pointerCount remains 1 after the gesture, even if there is no finger left on screen!

2. Pan/move gesture
```
[Log] onInteractionStart: pointerCount = 2 (main.dart.js, line 14198)
[Log] onInteractionUpdate: pointerCount = 2 (main.dart.js, line 14198)
...
[Log] onInteractionEnd: pointerCount = 1 (main.dart.js, line 14198)
```

**[X] This is wrong!** pointerCount starts with 2 but there is only one finger on the screen + pointerCount still does not return to 0 after finger has been released!


### Working scenario (Video: 0:20 - 0:37)

However, **when the very first gesture is a *pan gesture*, the issue does not occur** and pinch/zoom + pan/move works as expected.

1. Pan/move gesture (as very first gesture after app load)
```
[Log] onInteractionStart: pointerCount = 1 (main.dart.js, line 14198)
[Log] onInteractionUpdate: pointerCount = 1 (main.dart.js, line 14198, x41)
...
[Log] onInteractionEnd: pointerCount = 0 (main.dart.js, line 14198)
```

[√] pointerCount is zero (as expected) -> No finger left on screen

4. Pinch/zoom gesture
```
[Log] onInteractionStart: pointerCount = 2 (main.dart.js, line 14198)
[Log] onInteractionUpdate: pointerCount = 2 (main.dart.js, line 14198, x48)
...
[Log] onInteractionEnd: pointerCount = 1 (main.dart.js, line 14198)
[Log] onInteractionStart: pointerCount = 1 (main.dart.js, line 14198)
[Log] onInteractionUpdate: pointerCount = 1 (main.dart.js, line 14198)
[Log] onInteractionEnd: pointerCount = 0 (main.dart.js, line 14198)
```

[√] works as expected + pointerCount is zero at the end

5. Another pan gesture
```
[Log] onInteractionStart: pointerCount = 1 (main.dart.js, line 14198)
[Log] onInteractionUpdate: pointerCount = 1 (main.dart.js, line 14198, x39)
...
[Log] onInteractionEnd: pointerCount = 0 (main.dart.js, line 14198)
```

[√] works as expected + pointerCount is zero at the end

### Additional notes:

* The issue does also occur...
  a) when using Chrome browser on iPad
  b) when using HTML as web renderer

* The issue does not occur on other devices running Windows or Android

* The issue seems to be related with flutter gesture library, not with InteractiveViewer, as other Widgets are also broken like "flutter_map" which uses the plain flutter/gestures.dart

<details>
  <summary>flutter doctor (stable)</summary>

```
flutter doctor -v
[√] Flutter (Channel stable, 3.3.1, on Microsoft Windows [Version 10.0.22000.856], locale de-DE)
    • Flutter version 3.3.1 on channel stable at C:\build_tools\flutter-3
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4f9d92fbbd (6 days ago), 2022-09-06 17:54:53 -0700
    • Engine revision 3efdf03e73
    • Dart version 2.18.0
    • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at C:\Users\Marvin\AppData\Local\Android\Sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[√] VS Code (version 1.70.2)
    • VS Code at C:\Users\Marvin\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.46.0

[√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.102
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 105.0.1343.27

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>

<details>
  <summary>flutter doctor (master)</summary>

```
flutter doctor
Flutter 3.4.0-19.0.pre.221 • channel master • https://github.com/flutter/flutter.git
Framework • revision bbc42632a0 (2 hours ago) • 2022-09-13 02:52:39 -0400
Engine • revision 443b3646f8
Tools • Dart 2.19.0 (build 2.19.0-191.0.dev) • DevTools 2.17.0
```

</details>