Repository navigation
feat!: Make transparent hit-test opt-in via DeferHitTestToComponents - #4062
Merged
Merged
Conversation
luanpotter
marked this pull request as ready for review
September 27, 2026 16:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Make transparent hit-test opt-in via
DeferHitTestToComponents.FlameGameused to answercontainsEventHandlerAtby walking the component tree and reporting a hit only where a component implementedPointerInputCallbacks, which was an expensive recursive check for a feature I'd imagine nearly no one uses.This changes the default - it now reports a hit everywhere, like the base
Gameclass, and the tree walk is opt-in via a mixin. This only affects games built withHitTestBehavior.deferToChild, sinceopaqueandtranslucentnever consult the game. If you usedeferToChildto let events reach widgets behind theGameWidget, add the mixin, or overridecontainsEventHandlerAtwith a cheaper rule of your own.I think this is a saner alternative to @spydon 's #3982 , as we discussed before. The ultimate control is in the user hands to implement this in a more effective way w/o the mixin. This also uses the new marker interface to avoid having to list all types of click handlers.
Checklist
docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Migration instructions
Only applicable if you do want this specific behaviour; add the mixin to your
FlameGame: