https://kotlinlang.org logo
#compose
Title
# compose
p

pablisco

04/26/2022, 8:14 PM
What do you think folk? Is this a cool way to org a Design System with Compose? 🙂 https://twitter.com/pablisc0/status/1519046447391555584?s=20&t=YzrvR4kNS1X61lYEV-O1gQ
t

Tash

04/26/2022, 8:50 PM
This is pretty cool, we’re currently using a parameter to configure the Primary/Secondary variants, but we also don’t expect users to change the variant of a button on the fly, so representing as a parameter to the composable its not a great fit.
🐕 1
enum class + invoke function sure does make it more user friendly
p

pablisco

04/26/2022, 8:53 PM
Forgot to mention that the initial object solution doesn't work as well with auto complete in Android Studio. There is a bug somewhere that @Javier opened about this. ☺️
t

Tash

04/26/2022, 8:59 PM
Oh! I wonder what that issue is about 🤔 Just going through that solution more, it looks like having the variant as a receiver also makes sense because you’re configuring/tailoring the component (i.e. button in this case) to the variant you’re requesting
c

Colton Idle

04/27/2022, 12:56 AM
I think Adam Powell went through these sorts of things in this channel in the past. Specifically why something like TextField and OutlinedTextField were chosen to be different things. I think maybe @Louis Pullen-Freilich [G] also went into this here. Really insightful. I like to split up my composables like that now, and try not to have a style var or anything.
t

Tash

04/27/2022, 2:24 AM
Oh interesting! Do you remember if there was a specific thread that helped?
👀 1
z

Zoltan Demant

04/27/2022, 5:18 AM
Also curious about why it would be beneficial to use multiple composable functions for a common component! Isnt it easier to have one button composable that also accepts a style (filled/outlined/etc)? Ive used this approach in a large project and Ive seen 0 overlap (e.g. filled also needs some property X which doesnt make sense for outlined, etc).
c

Colton Idle

04/27/2022, 5:19 AM
I sweat that i saw this talked about with OutlinedTextField vs TextField, but the only thing I could find in slack was this: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1611087822290800 Throwback to Zach K before he was working at google 😄
👍 1
👍🏽 1
a

Andrey Kulikov

04/27/2022, 12:21 PM
1
☝️ 2
☝🏼 1
🙏 1
c

Colton Idle

04/27/2022, 5:20 PM
Aha. That's what I was remembering which is why i mentioned Louis Pullen-Freilich. awesome. thank you @Andrey Kulikov
t

Tash

04/27/2022, 5:36 PM
Oh great, missed this one, thanks!