2

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?

flauschtrud
  • 690
  • 7
  • 23
  • Seems like there's no option right now other than this. Best you can do is to make an extension with context function and keep this code in that and call it from composables. Which won't do much but hey atleast you don't need to add those ugly lines every screen. – WS Ayan Jul 21 '22 at 11:13

0 Answers0