Erlan Amanatov
10/27/2024, 5:09 AMenableEdgeToEdge
is configured as
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
navigationBarStyle = SystemBarStyle.dark(Color.argb(0x80, 0x1b, 0x1b, 0x1b))
)
Overall, everything works well, but when the ModalBottomSheet is displayed, the colors of the status bar and navigation bar change depending on the device's dark themeErfannj En
10/27/2024, 3:04 PMAlex Styl
10/27/2024, 3:28 PMenableEdgeToEdge()
changes the colors of the window of your activity. modals (such as the modalbottomsheet) have their own separate window, so you need to do changes on that.
I am not aware how to hold access to it. Worst case scenario, you can always use the Compose Unstyled ModalBottomSheet which gives you access to the LocalModalWindow
which you can style as you like (code example).Stylianos Gakis
10/27/2024, 8:04 PMWindowCompat.getInsetsController(window, window.decorView).apply {
isAppearanceLightStatusBars = properties.isAppearanceLightStatusBars
isAppearanceLightNavigationBars = properties.isAppearanceLightNavigationBars
}
right here: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]odalBottomSheet.android.kt;l=550-553?q=ModalBottomSheetDialog
Going up the call stack, there seems to take in a properties
parameter, where you can give your own values https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]se/material3/ModalBottomSheet.kt;l=136-140?q=ModalBottomSheet so you can decide if it's dark or not.
Looks very straightforward to me, give it a shot and lmk if it works or notErlan Amanatov
10/28/2024, 3:29 AMModalBottomSheet
function, thinking that there might be configuration parameters, but there aren't any.
I am using version 1.3.0 of the dependency androidx.compose.material3:material3
,
and ModalBottomSheetProperties
looks different there:
actual class ModalBottomSheetProperties(
val securePolicy: SecureFlagPolicy = SecureFlagPolicy.Inherit,
actual val shouldDismissOnBackPress: Boolean = true,
)
Erlan Amanatov
10/28/2024, 3:37 AMErlan Amanatov
10/28/2024, 4:04 AMErlan Amanatov
10/28/2024, 5:57 AMStylianos Gakis
10/28/2024, 6:39 AMErlan Amanatov
10/28/2024, 6:41 AM