Skip to content

refactor: Save event data by pointer in an extensible _RecognizerEventData structure#181113

Merged
auto-submit[bot] merged 7 commits into
flutter:masterfrom
luanpotter:luan.recognizer
May 6, 2026
Merged

refactor: Save event data by pointer in an extensible _RecognizerEventData structure#181113
auto-submit[bot] merged 7 commits into
flutter:masterfrom
luanpotter:luan.recognizer

Conversation

@luanpotter

Copy link
Copy Markdown
Contributor

Save event data by pointer in an extensible _RecognizerEventData structure instead of just PointerDeviceKind

This was extracted from #176968

The goal is to use a more flexible structure when storing event data by pointer on the GestureRecognizer class. Instead of storing just the kind, this also stores the buttons property and allows for adding more properties in the future if ever expanded. This supports the next step to add buttons to all events.

Note: this PR has no tests as it is a no-op change that should not affect any behaviour.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

…ntData structure instead of just PointerDeviceKind
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: gestures flutter/packages/flutter/gestures repository. labels Jan 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors GestureRecognizer to use a more extensible _RecognizerEventData structure for storing event data, instead of just the PointerDeviceKind. This new structure includes the buttons from the event, preparing for future enhancements. The changes are well-contained and correctly update the related methods. I've suggested adding documentation to the new _RecognizerEventData class to align with the project's style guide for maintainability.

Comment thread packages/flutter/lib/src/gestures/recognizer.dart Outdated
Comment thread packages/flutter/lib/src/gestures/recognizer.dart Outdated
@flutter-dashboard

Copy link
Copy Markdown

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #181113 at sha 2929d37

@flutter-dashboard flutter-dashboard Bot added the will affect goldens Changes to golden files label Jan 18, 2026
dkwingsmt
dkwingsmt previously approved these changes Jan 27, 2026

@dkwingsmt dkwingsmt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nits. Can you request a test exempt?

Comment thread packages/flutter/lib/src/gestures/recognizer.dart Outdated
Comment thread packages/flutter/lib/src/gestures/recognizer.dart Outdated
Renzo-Olivares
Renzo-Olivares previously approved these changes Feb 3, 2026

@Renzo-Olivares Renzo-Olivares left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo the pending comments.

@justinmc

Copy link
Copy Markdown
Contributor

@luanpotter Can you get these last nit comments so we can land this?

@flutter-dashboard

Copy link
Copy Markdown

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@Renzo-Olivares

Copy link
Copy Markdown
Contributor

Hi @luanpotter, is this something you still want to work on? There are still a few comments to address if we want to get this landed.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
@luanpotter luanpotter dismissed stale reviews from Renzo-Olivares and dkwingsmt via 3e58ca1 April 11, 2026 18:30
@luanpotter

Copy link
Copy Markdown
Contributor Author

@Renzo-Olivares , so sorry for the massive delay here, it is my bad. I got really sidetracked with work and other things. but I am back, and definitely would love to get the whole event button changes in. starting with this that I think is the simplest part at least.

I am addressing all comments right now 🙏 thank you for you patience on this

dkwingsmt
dkwingsmt previously approved these changes Apr 24, 2026

@dkwingsmt dkwingsmt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for your work!

Comment thread packages/flutter/lib/src/gestures/recognizer.dart Outdated
@dkwingsmt

Copy link
Copy Markdown
Contributor

Thank you very much for continuing this PR in the midst of other issues in life! Contributions are always appreciated.

I'll remind @Renzo-Olivares that this PR is ready for another review.

Can you request a test exempt in Flutter's Discord, channel #hackers?

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
@luanpotter

Copy link
Copy Markdown
Contributor Author

No worries my pleasure! Just asked for the exemtpion 🙏

@Renzo-Olivares Renzo-Olivares left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for the contribution @luanpotter!

@dkwingsmt dkwingsmt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD f: gestures flutter/packages/flutter/gestures repository. framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants