I'm using a `DismissibleNavigationDrawer` to creat...
# compose
j
I'm using a
DismissibleNavigationDrawer
to create a navigation drawer + content. I notice however, that the content (I have a vertical grid) has its contents 'spilling over' the edge of the screen when the drawer is active. How do I make it such that that it doesn't and instead, it's effective maximum area is the remaining screen real estate right of the navigation drawer?
I ended up using
Modifier.onPlaced
to track the offset of the
DismissibleDrawerSheet
and then subtract that from the overall screen width to set the effective width of the content:
Copy code
var contentOffset by remember { mutableStateOf(Offset.Zero) }

val screenWidth = LocalConfiguration.current.screenWidthDp.dp

val availableWidth =
 screenWidth - (with(LocalDensity.current) { contentOffset.x.dp.value.toDp() })


...
...

Modifier..onPlaced {
  contentOffset = Offset(it.boundsInRoot().right, 0f)
}