Hi! Do you know if it’s possible to change the siz...
# compose
c
Hi! Do you know if it’s possible to change the size of the
CheckBox
. I’m taking a look on the internal implementation and it defines his size as a private val
private val CheckboxSize = 20.dp
. I don’t know why some Framework components are not be able to change their size. Same for the padding, it has an internal padding
private val CheckboxDefaultPadding = 2.dp
and I can’t figure out how to get rid of it.
s
Maybe they are following some material guidelines to render the item? Have you tried creating your own composable that calls the layer below this material checkbox? This is what comes to my mind first.
c
It’s impossible to call the layer below because all of them are internal
a
Hello @Cacato86! Best i can tell you is to do checkbox by yourself, based on the one provided by compose... i't should'nt be difficult
c
Yes I know it, but I wanted to avoid to create a new component that is gonna be the same than the one that the Framework provides just because I can’t change the size. Doesn’t make sense to me this implementation strategy.
f
You can make a feature request to Googles issue tracker
c
I’ve just created this one: https://issuetracker.google.com/issues/197292079 Not sure if it’s the correct way to do it @Filip Wiesner
f
Should be fine 👍
🙌 1
c
Yes I know it, but I wanted to avoid to create a new component
The material team has said often that material is opinionated. so def file a feature request, but the beauty of compose is that custom composables are cheap. unlike android Views 😃
s
But he is right in this situation. All the lower level composables are not part of the public api. You need to go down to drawing lines yourself. To build it yourself is quite an involved process here, it should optimally be a bit easier imo
r
Have you tried
Modifier.scale
? Also, see this related issue: https://issuetracker.google.com/u/3/issues/180100697
👍 1
c
If you use
Modifier.scale
you will have this issue, at least with the checkbox 🤦
s
There is an answer on issue tracker here. It seems like they have some solid reasons as to why they are not giving any further customisability there. It seems like you have to do what we said initially, go to the source code and copy the internal/private functions and go from there. I wouldn’t wait for a ready made solution if I were you.
c
Ye, I’ve just answered to it, it’s ok, I would create my own Checkbox, but is a bit tiresome just copy/paste everything just for changing the size 🤷