Change just one status bar with Android and Jetpack Compose

I'm working on a project with Android and Jetpack Compose and I want to change the status bar color for just one view and the rest of them keeping with the assigned color.

How can I do this with Jetpack Compose? Is there a way to have more than one color in the status bar?


Solution 1:

You can do it following the doc here. You can update the system bar colors like so:

// Remember a SystemUiController
val systemUiController = rememberSystemUiController()
val useDarkIcons = MaterialTheme.colors.isLight

SideEffect {
    // Update all of the system bar colors to be transparent, and use
    // dark icons if we're in light theme
    systemUiController.setSystemBarsColor(
        color = Color.Transparent,
        darkIcons = useDarkIcons
    )