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

oday

07/08/2022, 4:33 PM
if I’d like to do something like this, this is a box with a surface inside and an icon inside the surface, sounds right?
j

Jorge Domínguez

07/08/2022, 4:42 PM
I'd say the
Box
with a
Modifier.background()
is enough
o

oday

07/08/2022, 4:57 PM
ah right
thanks makes sense
a

andrew

07/08/2022, 5:49 PM
nested surfaces are definitely overkill, if it can be made simply with primitives, do that. If it makes sense to componentize it, do that. 🙂
And a little offtopic, ticketswap sounds a lot like my previous gig @ lemonade.social
It was a fun time there 🙂
o

oday

07/08/2022, 7:22 PM
hehe, yes Ticketswap is definitely a fun place to be in, Amsterdam itself also
a

andrew

07/08/2022, 7:27 PM
I worked with 2 devs from the Netherlands, one was ex Razer, other ex Amazon
o

oday

07/08/2022, 7:45 PM
where do you work from now?
c

Colton Idle

07/08/2022, 8:00 PM
Looks like a box, CircleShape clip, with an icon. Or you could even recreate that icon using compose code.
a

andrew

07/08/2022, 8:04 PM
I still keep mine as drawables personally 😅
The icons, just tint them and all is good
What I'll do is store the resource IDs in an object
@oday I work for RealPage now, under their smart building division/acquisition: STRATIS
It's smart home but for multifamily, so apartments, student housing, etc
o

oday

07/08/2022, 8:09 PM
nice!
well @Colton Idle the issue with that is that if I were to want to set the background for that box with the circleshape clip, and have it have an opacity of something for example, the icon inside is getting affected
Copy code
Box(
    modifier = modifier
        .clip(CircleShape)
        .size((size.width / 2).dp, (size.height / 2).dp)
        .background(color.copy(alpha = 0.12f))
) {
    Icon(
        painter = painterResource(id = R.drawable.ic_sample_icon),
        modifier = modifier
            .size(size.width.dp, size.height.dp)
            .align(Alignment.Center),
        contentDescription = null
    )
}
a

andrew

07/08/2022, 8:11 PM
How is it affected, that shouldn't affect it 🤔
o

oday

07/08/2022, 8:12 PM
yea……as I was writing i realized that this doesn’t make sense, yea something else is up
a

andrew

07/08/2022, 8:12 PM
Screenshot?
o

oday

07/08/2022, 8:13 PM
yea it is not affecting it, just tried again
just a d’oh moment 🙂
there we go
a

andrew

07/08/2022, 8:18 PM
Nice!
3 Views