Hi Guys, I got an interesting question about jetpa...
# compose
Hi Guys, I got an interesting question about jetpack compose margin. As we can implement margin using padding or Spacer; Is it better to use padding instead? I said that because I now each composable is passed through compose, layout, drawing steps and I thought setting padding is just done on layout phase of that composable but Spacer will be passed in 3 phases separately. And Spacer creates extra Layout. Am I right?!
It's very unlikely that there is a significant performance penalty for using Spacer. It's not an Android View, and is very lightweight
☝🏻 1
Spacer does typically make for better reusability in components. There were some good convos about this a while back (like a year ago+) if you search this url in the chat history you'll get some details, but then again this blog post pretty much nails it. https://mxstbr.com/thoughts/margin/
+1 ^ also
is very deliberate; if you want to add space between something, then do it explicitly with a component that's made for it, rather than exploiting the padding/margin of something else.