K Merle
02/01/2022, 7:12 AMLazyColumn
. Only thing I could think of is using remember
, but I'd still would have to use remember
inside LazyColumn
.Albert Chang
02/01/2022, 8:32 AMColor
are marked with @Stable
so the runtime should have already done the optimization (i.e. only calling the function again if parameters changed).K Merle
02/01/2022, 9:09 AM@Stable
annotation to something like this optimize function on recomposition?
fun String?.toComposeColor(alpha: Int = 0xFF, defaultColor: Color = Color.Transparent): Color {
if (this.isNullOrEmpty()) return defaultColor
val color = android.graphics.Color.parseColor(this)
return Color(red = color.red, green = color.green, blue = color.blue, alpha = alpha)
}
Albert Chang
02/01/2022, 9:11 AMAndrey Kulikov
02/01/2022, 11:33 AM