Showkase: Dark mode demo not working
Hi.
I’m using this code to change (and animate) dark mode from a debug drawer:
@Composable
fun RestaurantMenuNumbersTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
darkThemeState: MutableState<Boolean> = remember { mutableStateOf(darkTheme) },
content: @Composable (MutableState<Boolean>) -> Unit,
) {
val transition = updateTransition(targetState = darkThemeState.value)
val colors = if (darkThemeState.value) {
DarkColorPalette
} else {
LightColorPalette
}
val animateColors = Colors(
primary = transition.animateColor { colors.primary }.value,
primaryVariant = transition.animateColor { colors.primaryVariant }.value,
secondary = transition.animateColor { colors.secondary }.value,
secondaryVariant = transition.animateColor { colors.secondaryVariant }.value,
background = transition.animateColor { colors.background }.value,
surface = transition.animateColor { colors.surface }.value,
error = transition.animateColor { colors.error }.value,
onPrimary = transition.animateColor { colors.onPrimary }.value,
onSecondary = transition.animateColor { colors.onSecondary }.value,
onBackground = transition.animateColor { colors.onBackground }.value,
onSurface = transition.animateColor { colors.onSurface }.value,
onError = transition.animateColor { colors.onError }.value,
isLight = colors.isLight,
)
MaterialTheme(
colors = animateColors,
typography = Typography,
shapes = Shapes,
content = { content(darkThemeState) }
)
}
So, showkase not shows the dark mode / l right mode correctly
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18
Uhmmm, I think yes … but no worry, feel free to close this issue