Pavel S
04/04/2024, 4:55 PMtheme
is equal to Theme.Material3
, the cupertino = { CupertinoTheme(//..
callback is called and vice-versa. Is this how it’s supposed to work? How to use dynamic colors in this case if dynamicLightColorScheme
dynamicDarkColorScheme
are android specific functions that return material3.ColorScheme
and not cupertino.theme.ColorScheme
? What do I need to do to just use cupertino theme on ios and material on android?Colton Idle
04/04/2024, 5:51 PMColton Idle
04/04/2024, 5:52 PMAlexander Zhirkevich
04/05/2024, 7:07 AMcontent
variable inside theme blocks. It described in the docs and AdaptiveTheme KDocAlexander Zhirkevich
04/05/2024, 7:08 AMAlexander Zhirkevich
04/05/2024, 7:22 AMPavel S
04/05/2024, 4:04 PMPavel S
04/05/2024, 4:07 PMAlexander Zhirkevich
04/05/2024, 4:24 PMPavel S
04/05/2024, 4:24 PMSurface
Alexander Zhirkevich
04/05/2024, 4:25 PMPavel S
04/05/2024, 4:25 PMAlexander Zhirkevich
04/05/2024, 4:25 PMAlexander Zhirkevich
04/05/2024, 4:25 PMPavel S
04/06/2024, 4:20 PMsystemBackground
token for it, even when Material3 theme is used, not sure why. Below is the code I’m using to configure the theme. I set the background color to 🟥 in Material scheme and systemBackground to 🟩 in Cupertino scheme. My expectation was that the background would be 🟥 on android and 🟩 on iOS. However the result is on the screenshots, both end up using the CupertinoTheme
@OptIn(ExperimentalAdaptiveApi::class)
@Composable
fun AppTheme(
isDarkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit,
) {
val colorScheme = if (isDarkTheme) {
darkColorScheme(background = Color.Red)
} else {
lightColorScheme(background = Color.Red)
}
val cupertinoColorScheme = if (isDarkTheme) {
io.github.alexzhirkevich.cupertino.theme.darkColorScheme(systemBackground = Color.Green)
} else {
io.github.alexzhirkevich.cupertino.theme.lightColorScheme(systemBackground = Color.Green)
}
AdaptiveTheme(
target = theme,
material = { theContent ->
MaterialTheme(
colorScheme = colorScheme,
content = theContent,
)
},
cupertino = { theContent ->
CupertinoTheme(
colorScheme = cupertinoColorScheme,
content = theContent,
)
},
content = content,
)
}
Pavel S
04/06/2024, 4:26 PMAlexander Zhirkevich
04/06/2024, 4:39 PMAdaptiveScaffold
uses systemBackground
for both themes. It will be fixed in upcoming releasePavel S
04/06/2024, 5:15 PM