james
03/04/2023, 12:51 AMImageVector
being remembered incorrectly? I’d like to know if this is a bug in rememberVectorPainter()
or if I’m just doing something silly. See thread for details 🧵 ➡️james
03/04/2023, 12:54 AMval icon = if (selected) MyIcon.Selected else MyIcon.Normal
val color = if (selected) Color.Green else Color.Black
Icon(
modifier = Modifier.size(48.dp),
imageVector = icon,
tint = color,
contentDescription = null,
)
MyIcon.Normal
and MyIcon.Selected
are both `ImageVector`s with identical `Path`s but different line stroke widths, and the name
argument provided to the builder is different for each of them too.
The problem I’m having is that code doesn’t update the icon when the selected
variable changes. The colour updates as expected but the image itself doesn’t, it continues to remember
the Normal
version 🤔james
03/04/2023, 12:55 AMSelected
version for initial composition and then switch to Normal
, it doesn’t changemyanmarking
03/04/2023, 6:22 PMjames
03/04/2023, 11:43 PMname
field of the ImageVector
and I see the change occur there