https://kotlinlang.org logo
#compose
Title
# compose
k

kotlinforandroid

07/11/2022, 4:07 PM
I have a compose app with edge to edge content that also uses
ModalBottomSheetLayout
. The problem I am facing is that the BottomSheets also draw under the statusbar. It looks weird when the sheet is not fully expanded since the sheet has a lot of padding visible at the top. How can I prevent this?
t

Tristan Hamilton

08/09/2022, 11:38 AM
It seems compose ModalBottomSheetLayout does not come with a way to change the status bar scrim so looking at possible solutions ended up adding https://google.github.io/accompanist/systemuicontroller/ to solve this in our app and just observing like this:
Copy code
LaunchedEffect(modalBottomSheetState.targetValue) {
      if (modalBottomSheetState.targetValue == ModalBottomSheetValue.Hidden) {
        systemUiController.setStatusBarColor(defaultStatusBarColor)
      } else {
        systemUiController.setStatusBarColor(scrimColor)
      }
    }
53 Views