Fudge
10/15/2019, 11:41 AMYour custom component can have whatever parameters it wants:I think you misunderstood what I was trying to say. Using the
@Composable
padding design, padding can be applied always, with no need for anything from the wrapped component:
@Composable fun MyButton( ...) {
Button(...)
}
In this case MyButton
is clean from any modifier
or padding
boilerplate. However, this doesn't prevent it from having padding:
Padding {
MyButton(...)
}
Yes this indentation is unfortunate (which is why SwiftUI opted for a .
modifier syntax), but it is certainly better than being forced to have this Modifier
parameter as part of your component, and needing to pass it on.
This is nothing new. See quotes from @Adam Powell from 4 months ago:
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1559657032032200?thread_ts=1559597743.089600&cid=CJLTWPH7S
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1559657434033300?thread_ts=1559597743.089600