feat!: The HasTappableComponents mixin is no longer needed#2450
Merged
Conversation
…appablecomponents
HasTappableComponents mixin is no longer neededHasTappableComponents mixin is no longer needed
luanpotter
reviewed
Mar 31, 2023
luanpotter
reviewed
Mar 31, 2023
erickzanardo
reviewed
Apr 2, 2023
Member
erickzanardo
left a comment
There was a problem hiding this comment.
Great job 🔥! Overall LGTM, just left a couple of simple comments!
Co-authored-by: Erick <erickzanardoo@gmail.com>
7 tasks
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
This PR is the second in a series of refactors that aim to simplify event handling in Flame. The approach is as follows:
MultiTapDispatchercomponent, which contains the logic that used to be within theHasTappableComponentsmixin. This component is internal; it mounts to aFlameGamedirectly, and ensures that it is a singleton.TapCallbackscomponent is added to a game, it automatically adds theMultiTapDispatchercomponent (unless there is already one), which in turn registers a tap gesture detector withGestureDetectorBuilderand rebuilds the game widget.The end result is that now in order to make a component tappable you only need to add the
TapCallbacksmixin to that component, everything else will be handled by the framework.Consequently, the
HasTappableComponentsmixin is now empty and marked as deprecated.Checklist
docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Migration instructions
The
HasTappableComponentsmixin is now empty & deprecated. If your game used this mixin overriding its methodsonTapDown,onTapUp, etc -- then they will no longer work. If you want to receive tap events at the top level of the game, then simply add aTapCallbackscomponent to the top level of the game.Related Issues
WIP for #1733