Cristian Rosa
08/20/2021, 5:02 PM@Preview(showBackground = true, name = "myPreview (Dark)")
@Composable
fun DefaultPreviewDark() {
MyTheme(darkTheme = true) {
MyScreeContentWithArgument()
}
}
where
@Composable
fun MyTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit
) {
val colors = if (darkTheme) {
myDarkTheme
} else {
myLightTheme
}
MaterialTheme(
colors = colors,
typography = Typography,
shapes = Shapes,
content = content
)
}
Android studio doesn’t show up the preview in dark mode
but installing on a device everything work correctly.
compose_version = 1.0.1
kotlin 1.5.21