Jerry Johns
11/29/2024, 6:26 PMDismissibleNavigationDrawer
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?Jerry Johns
12/03/2024, 12:13 AMModifier.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:
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)
}