You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to render a zoomable/panable Stack - that is a large photo with positioned informations on top of it.
Here is an example:
Stack(
fit:StackFit.expand,
clipBehavior:Clip.none,
children: [
constImage(
image:AssetImage(
'assets/images/some-photo.jpg'), // This may be large (eg. height 5000 x width 3000)
),
Positioned( // The values are based on the photo dimension, in order to inform a specific area
top:2500,
left:1500,
child:Container(
color:Colors.red.withOpacity(0.5),
width:380,
height:380,
),
),
],
),
Thing is Stack resizes the children to fit its container:
the image is resized to container height
the Positioned is placed according to the container's dimension, that is likely off screen considering the offset values.
In any case, positioned locations is desynchronized with the image underneath.
One solution I found was to make the Stack grow as much as needed. This way I ensure the underneath image is not shrinked, and the positionned elements remain correct:
I found a solution with InteractiveViewer() - that is to set its constrained property to false.
This way, the children are not constrained and the Stack layout is respected. And no need to have any Overflowbox messing around.
I'm trying to render a zoomable/panable Stack - that is a large photo with positioned informations on top of it.
Here is an example:
Thing is Stack resizes the children to fit its container:
In any case, positioned locations is desynchronized with the image underneath.
One solution I found was to make the Stack grow as much as needed. This way I ensure the underneath image is not shrinked, and the positionned elements remain correct:
Although content of the Stack is now correct, if I put this in PhotoView, the PhotoViewComputedScale is not correct:
Indeed, the Overflowbox dimension seems not to be taken into account. I tried to wrapped it in a SizedBox at image's dimension with no success.
Would you know how to solve this?
Thanks!
The text was updated successfully, but these errors were encountered: