Raphael TEYSSANDIER
08/08/2024, 8:19 AMStylianos Gakis
08/08/2024, 8:52 AMRaphael TEYSSANDIER
08/08/2024, 9:02 AMadjustResize
, for the BottomSheet I tried navigationBars.only(Bottom)
Raphael TEYSSANDIER
08/08/2024, 9:03 AMHugo Bernardi
08/08/2024, 9:35 AMenableEdgeToEdge(navigationBarStyle = SystemBarStyle.light(android.graphics.Color.TRANSPARENT, android.graphics.Color.TRANSPARENT))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) window.isNavigationBarContrastEnforced = false
light is important here, according to the doc of auto :
Creates a new instance of [SystemBarStyle]. This style detects the dark mode
* automatically and applies the recommended style for each of the status bar and the
* navigation bar. If this style doesn't work for your app, consider using either [dark] or
* [light].
* - On API level 29 and above, both the status bar and the navigation bar will be
* transparent. However, the navigation bar with 3 or 2 buttons will have a translucent
* scrim. This scrim color is provided by the platform and *cannot be customized*.
* - On API level 28 and below, the status bar will be transparent, and the navigation bar
* will have one of the specified scrim colors depending on the dark mode.
Raphael TEYSSANDIER
08/08/2024, 9:35 AMStylianos Gakis
08/08/2024, 10:12 AMSystemBarStyle.auto()
it does some stuff around the contrast which I remember I found not obvious.
Instead I've done this now
@Composable
private fun EnableEdgeToEdgeSideEffect(
darkTheme: Boolean,
) {
DisposableEffect(darkTheme) {
val systemBarStyle = when (darkTheme) {
true -> SystemBarStyle.dark(Color.TRANSPARENT)
false -> SystemBarStyle.light(Color.TRANSPARENT, Color.TRANSPARENT)
}
enableEdgeToEdge(
statusBarStyle = systemBarStyle,
navigationBarStyle = systemBarStyle,
)
onDispose {}
}
}
Which explicitly uses the .dark or .light version depending on if you are in dark or light mode, and this makes the nav bar truly transparent.
This way you also don't need to change the window.isNavigationBarContrastEnforced
or anything like thatAlex Vanyo
08/08/2024, 5:01 PMModalBottomSheet
?Raphael TEYSSANDIER
08/08/2024, 5:04 PM