Justin McCandless e7a8dc3a27
iPad Scribble flicker and crash (#159508)
Previously, dragging to select with an Apple Pencil on an iPad
(Scribble) caused the context menu to rapidly hide and show. Sometimes
this even caused an assertion error when using SystemContextMenu due to
showing two context menus in one frame. After this PR, the flicker and
crash are gone.

The flicker happened on both the Flutter-rendered context menu and
SystemContextMenu, but the error only happened with SystemContextMenu
due to a safeguard that prevents two from showing at the same time.

The flickering is likely a regression caused by
https://github.com/flutter/flutter/pull/142463.

| Before this PR | After this PR |
| --- | --- |
| <video
src="https://github.com/user-attachments/assets/e35f36f5-350d-41fb-b878-ee7b7820699d"
/> | <video
src="https://github.com/user-attachments/assets/262cb8d3-6670-4765-ace8-2d9bf61ae112"
/> |

Flutter's behavior isn't perfect compared to native (below), but it's a
major improvement. If we want to match native, I think we might have to
mess with the engine and see why it's calling showToolbar so much. I
checked and scribbleInProgress is false during this selection gesture,
so we can't use that.

<details>

<summary>Scribble native video</summary>



https://github.com/user-attachments/assets/207e208a-ac36-4c9e-a8ed-9e90e6ef9e3a



</details>


Fixes https://github.com/flutter/flutter/issues/159259
2024-12-02 17:45:36 +00:00
..