What's the difference between Modifier.heightIn(...) and Modifier.preferredHeight()? They seem to work the same way in my trials.. Does anyone know when to use what and in what scenarios?
Modifier.preferredHeight() sets the height which can be overridden by constraints, instead of Modifier.height, that sets the height regardless of the incoming constraints.
Modifier.heightIn() forces the content to comply with these constraints and centers it in the case that the content is larger than maximum or smaller than minimum.
On a side note, these two functions serve different purposes since the first one takes one argument, and the second takes two. Because of that, they would hardly do the same thing.
Notice there are other functions for width and height, as well as "size", which includes both of them. By looking in the source code (Ctrl + click | Cmd + click), it's possible to see all possibilities and documentation explaining the functionality.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With