Skip to content

Expose buttons on TapDownDetails and TapUpDetails #176583

Description

@luanpotter

Use case

The "raw" PointerEvent has a field buttons to figure what which buttons were pressed; notably in the cause of mouses it is particularly relevant to distinguish between left, right and middle clicks.

However, when using the more user-friendly recognizers, that expose events as TapUpDetails and TapDownDetails, this field is not propagated. In particularly, it is jarring to use MultiTapGestureRecognizer, because you can set a allowedButtonsFilter, but if you allow more than one type of button, you won't be able to determine which one it was (at least as far as I can tell).

Proposal

I believe adding this would be very simple, though with the caveat that if we want to avoid breaking changes we need to make it optional. I suspect that is historically how the kind field was added to TapDownDetails because is also optional (though it is required on TapUpDetails, so maybe we are willing to add a required field - honestly I don't expect users to be creating "synthetic" events all that often and would be a very simple fix if they are).

As a proof of concept, I have started working on a PR showing how it could be added (still need to add some tests, but wanted to raise the discussion on an issue first).

Metadata

Metadata

Assignees

Labels

Bot is counting down the days until it unassigns the issueP2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: gesturesflutter/packages/flutter/gestures repository.frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions