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

ziv kesten

12/26/2021, 2:35 PM
I would like to customize the Jetpack compose CheckBox with things like
strokeWidth
,
RadiusSize
,
CheckboxSize
etc'. However those properties are not public. I could just copy the entire CheckBox Code into my project and expose those values to be mutable but the would mean introducing alot of code in my project. is there a better way to customize these properties of
CheckBox
in Jetpack Compose?
a

Arjun Achatz

12/26/2021, 4:30 PM
I actually wrote one from scratch, it's really easy
But yes super annoying that these are private
k

Kirill Grouchnikov

12/26/2021, 4:46 PM
The
CheckBox
you refer to is part of the Material module. It implements a specific design system, and is not meant to be the generic jack-of-all-trades component. If you're looking for that level of customization, the Compose way is to create your own design system on top of the lower layers of Compose, just like the Material module is built.
👍 2
z

ziv kesten

12/26/2021, 4:51 PM
I understand what you are saying but I feel like there is a lot of functionality in that checkbox that is unlikely to change from one design system to the other. So while having a MaterialCheckBox can be useful, if we had a stripped down checkbox with private logic but public parameters, we could be customizing it without copy and pasting tons of checkbox code into my app just to change simple parameters like stroke width or unselected box color.
s

Stylianos Gakis

12/26/2021, 10:37 PM
Reminds me of a discussion I’ve been part of in this channel a while back. With the most definitive answer imo given here. As it seems, yes, you’d have to do it your own way if you’re not going to follow the material guidelines.
z

ziv kesten

12/27/2021, 9:27 AM
Thank you so much for this reply! sadly, it answered my question exactly 🥲, this should be pinned as i feel like it would be asked many times over.
s

Stylianos Gakis

12/27/2021, 12:26 PM
Yeah I know, but there’s nothing that will stop more people having the same problem and coming here for information. At least now more people know about it, so the next person who asks hopefully gets answered by someone else who’s seen that discussion before 😄 I mean we also have the solution of actually fixing the problem, but I don’t see that happening anytime soon 😅
😂 1
🙏 1
9 Views