How to best change systemBarsBehavior with Jetpack Compose?

693 Views Asked by At

I'm using Compose and I want to have a fullscreen composable while also modifying the swipe behavior of the system bars.

I'm using the Google Accompanist SystemUiController to hide and show the system bars which works just fine, but does not allow to control the swipe behavior.

I am able to set the system bars behavior by using

val activity = LocalContext.current as Activity
with(WindowCompat.getInsetsController(activity.window, activity.window.decorView)) {
   systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
}

(as described in the not-compose-specific doc for immersive mode)

But this solution does not seem to be very "compose-like". Is there a more compose-specific way for doing this where I do not have to explicitly refer to the activity?

0

There are 0 best solutions below