Compose Modifier

fitOutside

If one of the [Ruler]s in [rulers] has a value within the bounds of the Layout, this sizes the content to that [Ruler] and the edge.

FitInsideOutsideExample

@Composable
fun FitInsideOutsideExample() {
    Box(Modifier.fillMaxSize()) {
        // Drawn behind the status bar
        Box(Modifier.fillMaxSize().fitOutside(StatusBars.current).background(Color.Blue))
        // Drawn behind the navigation bar
        Box(Modifier.fillMaxSize().fitOutside(NavigationBars.current).background(Color.Red))
        // Body of the app
        Box(Modifier.fillMaxSize().fitInside(SafeContent.current).background(Color.Yellow))
    }
}