Hello! I rewrote logic of MaterialTheme and the ap...
# compose
a
Hello! I rewrote logic of MaterialTheme and the app doesn’t use colors from dark theme when it is in dark theme. For example, in code I use it like
modifier = Modifier(background = AppTheme.colors.background)
but in dark theme it shows background color for light theme. Here is a theme implementation
AppColors.kt
https://gist.github.com/llama-0/9b92e8eed30fe65bbdc3b47bf57a1a49
AppTypography.kt
https://gist.github.com/llama-0/99f58df22ae9dbb8adb55dea410136c0
AppTheme.kt
https://gist.github.com/llama-0/4c65f4aa7fdccf8b35ca089f6b30fac1 Any thoughts?
Should I be wrapping everything compose related in
Copy code
AppTheme {}
? Is there a better solution ( like in old days you just put
style/Theme.AppTheme
in
AndroidManifest.xml
) ?
g
You should wrap it with
AppTheme
, otherwise the composables won’t know which instance to provide via local composition. But if you’re not using any interop or fragments, it should be enough to use it just once in your root composable.
a
Unfortunately, I use fragments too. Thanks for sharing your knowledge, Georgiy.