Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add propagateGesturesToChild to the MoonButton #438

Closed
wants to merge 1 commit into from

Conversation

trejdych
Copy link

Hello,

first of all, thank you for a great package. If you prefer to create an issue first, please let me know. And sorry if I broke conventional commits, I hope everything is fine though :)

Why do we need this property?
we use patrol_finders in our project. However, patroltester's tap() method has custom logic which based on hitTestable(). So when we find a widget by MoonButton's child (e.g. by text) we can't tap on it because MoonBaseControl absorbs the interaction.

If you want to play with it there is a sample repository. The last test 'moonbutton patrol' fails

@Kypsis
Copy link
Collaborator

Kypsis commented Aug 30, 2024

Thank you for the PR and sample repo outlining your problem. Exposing propagateGesturesToChild is not quite the direction we want to go as it would not only affect the button but every interactable using MoonBaseControl by extension. This is something that falls under the category of leaky abstraction and bloats the interactables API.

Find by text is in my personal opinion very flaky approach due to i18n. Have you considered using Patrolsfind.byKey() finder or other alternatives?

@trejdych
Copy link
Author

Thank you for your response.
I'm aware of i18n, but it's not the issue for us. I kind of prefer "tap on what a user sees" to "tap on an element with a key". I think I found a compromise, instead of $('text').tap() (search text widget) $(MoonButton).contains('text') (search button contains text). But yes, I will consider keys too.

I have a question though. Could you explain to me the reason why MoonButton has propagateGesturesToChild = false? I don't quite see the use case, It is to prevent something like MoonButton(onTap: () {}, label: GestureDetector(...),)? Thanks a lot :)

@trejdych trejdych closed this by deleting the head repository Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants