Hi I'm new to compose and I'm trying to debug this weird text color bug
Color should be white and it's like a grey dark which seems to disappear and set white color once I scroll them out of sight and scroll back to the previous positions.
Pretty sure someone had this error before, am I missing something? Why does this error happen?
Edit: This only happens when my phone has dark mode activated. If I deactivate it and set false/true in TodoTheme(...) everything works as expected.
Most simple code to repro:
setContent {
TodoTheme {
TodoScreen()
}
}
@Composable
fun TodoScreen(
) {
val text = "This is a big text that will make color change and won't be very much visible for the user, why does this happen?"
LazyColumn(){
items(listOf(text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text)) { string ->
Text(text = string, color = MaterialTheme.colors.onSurface)
}
}
}
Colors are the one by default (I don't think this is a color problem):
val LightThemeColors = lightColors(
primary = Purple700,
primaryVariant = Purple800,
onPrimary = Color.White,
secondary = Color.White,
onSecondary = Color.Black,
background = Color.White,
onBackground = Color.Black,
surface = Color.White,
onSurface = Color.Black,
error = Red800,
onError = Color.White
)
val DarkThemeColors = darkColors(
primary = Purple300,
primaryVariant = Purple600,
onPrimary = Color.Black,
secondary = Color.Black,
onSecondary = Color.White,
background = Color.Black,
onBackground = Color.White,
surface = Color.Black,
onSurface = Color.White,
error = Red300,
onError = Color.Black
)
Here's a video that you'll be able to watch exactly what's happening. This is on a Redmi Note 8 Pro. https://www.youtube.com/watch?v=MwVO62NXCQU



