perlatus / flutter_zoomable_image

A plugin for panning and zooming images by touch.
ISC License
119 stars 43 forks source link

Gestures not working if ZoomableImage is wrapped in a Scaffold #8

Closed hugovangalen closed 7 years ago

hugovangalen commented 7 years ago

In the method _child(), it seems like the CustomPaint() that is instantiated requires a valid "child" object in order for the gesture detector to function correctly if used in a Scaffold.

I added an empty container as a child, and then things started working as expected, so I believe this may be related to this mentioned in the docs on CustomPaint:

Custom painters normally size themselves to their child. If they do not have a child, they attempt to size themselves to the size, which defaults to Size.zero.

perlatus commented 7 years ago

I updated the example to use a Scaffold. Before making your suggested changes, it didn't display at all actually.

Take a look and see if this fixes it on your end: https://github.com/perlatus/flutter_zoomable_image/tree/bugfix_scaffold

Thanks for the bug report.

hugovangalen commented 7 years ago

Yes, come think of it, I do recollect observing a black background at some point.

I was messing around with different layouts trying to pinpoint the issue with the gestures. Depending on the parent widget, the image did not paint at all, or only a part of the image was visible. (I guess that all can be explained if the widget is confused about its own size.)

Anyway, it's okay now. Great!

perlatus commented 7 years ago

Cool, the fix is in v1.1.1