-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Description
I see many widgets meant to make its child as big as it wants, like Expanded, Flexible, BoxConstraints.expand(), SizedBox.expand, but many times I want to set a widget to be as small as possible, analog to Android's wrap_content.
Sometimes I get rendering Exceptions because the framework can't calculate the size of a widget, as when using Row and Column together, as explained here. The solution presented is always to use Expanded, but what if I don't want that content to expand? What if I want it as small as it can be without clipping anything?
The solution is usually to use multiple Expanded and Spacer with different flex parameters, but still this isn't perfect as negotiating flex values isn't what we always want, as the Spacer will not vanish if the screen gets smaller, it will try to maintain it's proportionality, forcing my widget to get smaller.
Maybe I am missing something about the way the framework works, so then this would be lack of tutorials, or maybe the Framework is missing a ShrinkWrap widget (as this is a property of some widgets already) or something with a similar name, that will size the wrapped widget to be as small as it can be.
Example of a problem that could benefit from this here, as I couldn't find how to solve this, even with IntrinsicHeight.