It doesn't matter what widget I wrap it with to constrain the height, it will always overflow in the bottom by a few pixels while the horizontal resizing works fine.

In my case, I need both these widgets to be of same size by restricted its dimensions. I can increase the max height to a bigger number but it ruins the aesthetic and won't be consistent across devices.