Skip to content

Commit

Permalink
[CupertinoActionSheet] Add sliding tap gesture (#149471)
Browse files Browse the repository at this point in the history
This PR implements the `CupertinoActionSheet` part of flutter/flutter#19786. 

This PR creates a new kind of gesture "sliding tap", which can be a simple tap but also allows the user to slide to other buttons during the tap, and select the button that the slide ends in.

The following video shows the behavior on a button list (left to right: Native iOS, after PR, before PR):

https://github.com/flutter/flutter/assets/1596656/1718630d-6890-4833-908b-762332a39568

Notice:
1. When the tap starts on a button or on the content section, the gesture can slide into a button to highlight it or activate it.
2. When the user performs a quick tap on a button, the button is immediately highlighted. (Before the PR, the highlight waits until the time out of a tap gesture, causing a quick tap to not highlight anything at all.)

The following video shows the behavior when the actions section scrolls (left to right: Native iOS, after PR)

https://github.com/flutter/flutter/assets/1596656/5eb70bc1-ec25-4376-9500-2aaa12f0034b

Notice:
1. Moving left or right doesn't cancel sliding tap, but moving vertically prioritizes the scrolling.
2. Moving before the drag starts is also recognized as a sliding tap.

Also, multiple pointers interact with the button list following an algorithm of "using earliest pointer". I can't record videos about it but I've added unit tests.
  • Loading branch information
dkwingsmt authored Jun 6, 2024
1 parent 27972eb commit 87f68a8
Show file tree
Hide file tree
Showing 2 changed files with 724 additions and 24 deletions.
Loading

0 comments on commit 87f68a8

Please sign in to comment.