When I'm just putting a colored rectangle on my UI...
# compose
t
When I'm just putting a colored rectangle on my UI, I can do it all with modifiers. I can use a Spacer or a Box (without content). Is there a preference for one or the other (presuming I'm doing it in a Box where it's not really effect sibling layouts)
l
Spacer and Box use different strategies to decide their actual size. See their MeasurePolicy implementations. I recommend you to learn how measurement is performed in compose first, like this series: https://youtube.com/playlist?list=PLWz5rJ2EKKc94tpHND8pW8Qt8ZfT1a4cq (I can't recall if MeasurePolicy is covered but these are worth watching). Anyway, choose the one with the best semantics, like from your description you'd better use a Box because Spacer should only be used for spacing and not have any visual effects or interactions itself.