Jason Ankers
01/29/2021, 3:52 AM1.0.0-alpha11
? Previously was doing:
vectorResource(R.drawable.ic_target).copy(defaultHeight = 18.dp, defaultWidth = 18.dp)
Andrey Kulikov
01/29/2021, 12:11 PMAndrey Kulikov
01/29/2021, 12:11 PMSam
01/29/2021, 8:25 PMcopy
as welll to resize, e.g.
Icons.Rounded.Check.copy(defaultHeight = 42.dp, defaultWidth = 42.dp)
but it’s not working anymore and i really can’t figure out how to get my code compiling @Nader Jawad @Andrey Kulikov @Jason AnkersNader Jawad
01/29/2021, 8:26 PMSam
01/29/2021, 8:27 PMNader Jawad
01/29/2021, 8:27 PMNader Jawad
01/29/2021, 8:27 PMNader Jawad
01/29/2021, 8:27 PMSam
01/29/2021, 8:28 PMNader Jawad
01/29/2021, 8:28 PMSam
01/29/2021, 8:28 PMcopy
solutionNader Jawad
01/29/2021, 8:28 PMNader Jawad
01/29/2021, 8:29 PMSam
01/29/2021, 8:29 PMNader Jawad
01/29/2021, 8:29 PMSam
01/29/2021, 8:30 PMcopy
but it was the only thing that worked about a month ago. i have 33 compile errors with this, so i’d have to change all of them just to test if it now works…Nader Jawad
01/29/2021, 8:30 PMSam
01/29/2021, 8:31 PMcopy
https://stackoverflow.com/questions/64377952/material-icon-size-adjustment-in-jetpack-composeNader Jawad
01/29/2021, 8:36 PMSam
01/29/2021, 8:43 PMIcons.Rounded.ChevronLeft.copy(defaultWidth = 32.dp, defaultHeight = 32.dp)
to use the icon as 32.dp instead of smaller. how can i write jetpack compose to make it the desired size?Nader Jawad
01/29/2021, 8:44 PMNader Jawad
01/29/2021, 8:46 PMImage(
imageVector = Icons.Rounded.ChevronLeft,
modifier = Modifier.preferredSize(32.dp, 32.dp),
contentDescription = "Chevon left"
)
Sam
01/29/2021, 8:48 PMIcon
composable, and that is the tint
Icon(imageVector = Icons.Rounded.ChevronLeft.copy(defaultWidth = 32.dp, defaultHeight = 32.dp), tint = Color.White)
Sam
01/29/2021, 8:48 PMImage
composable, do i lose this ability to easily switch the color?Nader Jawad
01/29/2021, 8:49 PMNader Jawad
01/29/2021, 8:49 PMSam
01/29/2021, 8:50 PMcolorFilter
is the equivalent of tint
?Nader Jawad
01/29/2021, 8:50 PMNader Jawad
01/29/2021, 8:50 PMImage(
imageVector = Icons.Rounded.ChevronLeft,
modifier = Modifier.preferredSize(32.dp, 32.dp),
contentDescription = "Chevon left",
colorFilter = ColorFilter.tint(Color.White)
)
Nader Jawad
01/29/2021, 8:51 PMSam
01/29/2021, 8:52 PMalpha11
🙂Sam
01/29/2021, 8:52 PMSam
01/29/2021, 8:53 PMcolor.contentColor
there’s actually a few places i do this to slightly modify a color, but is there a recommended way to adjust this nowSam
01/29/2021, 8:54 PMState<Color>
in this situationNader Jawad
01/29/2021, 9:00 PMColor.kt
which is an inline classSam
01/29/2021, 9:02 PMcolors.contentColor(true).value.copy(alpha = 1f)
in this case and it worked! i lifted this from somewhere in androidx source, so ill revisit to refactor according to latest practicesNader Jawad
01/29/2021, 9:02 PMstate.value
Nader Jawad
01/29/2021, 9:02 PM