Stylianos Gakis
04/03/2024, 10:36 PMBox? Spacer? Something else?
I’ve always been using Box but as I see the impl it does do more than what Spacer does which I am actually not interested in for those cases, like pass a BoxScope to the content.Ben Trengrove [G]
04/03/2024, 10:42 PMStylianos Gakis
04/03/2024, 10:46 PMSpacer and I instinctively tried to suggest to use a Box as that is what we typically use.
Only to then realize that I would be suggesting a worse solution for no reason.
I think seeing Canvas use Spacer is exactly what I needed to see.
Won’t go over the codebase migrating everything, but I’ll take one less remember and the BoxMeasurePolicy etc in future cases on each of those call sites 😄 Thanks!Albert Chang
04/04/2024, 3:49 AMBox overload without the content parameter here doesn't remember anything and is essentially the same as Spacer. I don't believe there is any difference in performance.
Btw which to use is not unified even in compose codebase. For example Icon uses Box (source).Ben Trengrove [G]
04/04/2024, 3:59 AMBen Trengrove [G]
04/04/2024, 4:00 AMBox(Modifier.foo) not Box(Modifier.foo) {}