make widgets the same width and height

Resolved

I have an Image inside a Stack which is currently taking up the width of it's parent and has an unknown height because the height is however heigh the image is. Both change depending on the screen's width. So, nothing out of the ordinary so far.

I have a container that I want to put on top of it because I want to animate a step by step gradual reveal of the image. That means I need multiple containers to mask the image since FlutterFlow doesn't have masks or the ability to add more than one animation.

Since the height of the image is unknown I set the covering container to 25% width and 100% height.

Both the width and height are percentages relative to the screen itself rather than the parent widget which is in no way useful in any possible scenario.

In iOS I can just write in one line "the height of the container is the height of the image" and animate it in 25% width increments.
In Flutter I can add a LayoutConstraint widget which may or may not have the correct height but most likely it won't and I'll need to use a Key of some sort to retrieve the height of the image in a post frame widget binding function and then redraw the screen now knowing what the height of the image is.

How do I get the height of the masking Container to be the height of the image?

Do I have to hard code a height so it's disproportional on different screen sizes? Or is there another way to do this?

1
2 replies