marcglasberg / align_positioned

Flutter Package: When your desired layout or animation is too complex for Columns and Rows, this widget lets you position/size/rotate/transform its child in complex ways.
BSD 2-Clause "Simplified" License
75 stars 8 forks source link

GestureDetector outside the original area. #7

Closed jifferon closed 3 years ago

jifferon commented 3 years ago

Try to recreate a sample code from the first example (with a semi-transparent circle on the left of the red container) and wrap that circle into Material -> InkWell.

Tap will be recognized only if you tap on the overlapping with the red container section of the circle, otherwise, it will be ignored.

Working tap area is this:

edInkedalignPos1_LI

Whereas anyone would expect it to be the whole circle widget.

marcglasberg commented 3 years ago

Please, see this:

https://github.com/flutter/flutter/issues/19445

I could try to fix this in the future, but at the moment I'm not sure it's possible.

yasinarik commented 3 years ago

Please, see this:

flutter/flutter#19445

I could try to fix this in the future, but at the moment I'm not sure it's possible.

I've been following this issue for a long time. Huge respect to you for carrying it.

I think you would share it already if you found a solution. So there isn't one yet, unfortunately, but if you can, you will make lots of things possible that are impossible to do now.

As a mechanical engineer and a Flutter developer myself too, I just wanted to thank you again for bringing so much value to this community. :)

marcglasberg commented 3 years ago

This is fixed in version 2.0.4.

To see it working, please run this example:

https://github.com/marcglasberg/align_positioned/blob/master/example/lib/main_tap.dart

The example presents a circle which is half outside the AlignPositioned area (in red), but feels the tap both inside and outside of that area. Tap it to see a color change. This is possible because the AlignPositioned widget has a special hitText method which does not cull the tap position.

However, all native Flutter widgets cull the tap position. If an AlignPositioned is inside a native Flutter widget parent, that parent will cull the tap position, rendering the AlignPositioned larger area useless. For more information, see:

For this reason, I don't think this feature is very useful in practice, unfortunately.

Adam-Langley commented 1 year ago

Update for anyone wanting to resolve this issue - look into defer_pointer

I've used this with success to enable gesture capture on widget regions painted outside of the parent widgets clipping boundary.