Priyanshu Jain
08/27/2023, 8:54 AMisSystemInDarkTheme()
flag does not set dark theme on iOS. It works as expected on android. Using 1.5.0-rc06
version of compose multiplatform.Priyanshu Jain
08/27/2023, 8:57 AMisSystemInDarkTheme()
flag.
@Composable
expect fun AppTheme(
useDarkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit
)
Priyanshu Jain
08/27/2023, 9:00 AM@Composable
actual fun AppTheme(
useDarkTheme: Boolean,
content: @Composable () -> Unit
) {
val colors = when {
useDarkTheme -> DarkColors
else -> LightColors
}
MaterialTheme(
colorScheme = colors,
content = content
)
}
Alexander Zhirkevich
08/27/2023, 6:59 PMFarid Benhaimoud
08/27/2023, 9:00 PMreturn ComposeUIViewController {
val darkTheme = UIScreen.mainScreen.traitCollection.userInterfaceStyle ==
UIUserInterfaceStyle.UIUserInterfaceStyleDark
...
// Bind safe area as the value for LocalSafeArea
CompositionLocalProvider(LocalSafeArea provides safeArea) {
TalamydAppTheme(darkTheme) {
Surface(
color = MaterialTheme.colorScheme.background,
modifier = Modifier.fillMaxSize()
) {
ContentView(
component = root,
)
}
}
}
}
@Composable
fun TalamydAppTheme(
darkTheme: Boolean,
content: @Composable () -> Unit
) {
val colors = if (darkTheme) DarkColorScheme else LightColorScheme
MaterialTheme(
colorScheme = colors,
content = content,
typography = Typography
)
}
Priyanshu Jain
08/28/2023, 5:55 AMPriyanshu Jain
08/28/2023, 5:56 AMPriyanshu Jain
08/28/2023, 10:20 AM.preferredColorScheme(.light)
this line in iosApp.swift file.Dima Avdeev
08/28/2023, 4:46 PM