Skip to content

Form content clipping fix #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -354,18 +354,18 @@ private fun BottomSheetScaffoldLayout(
val layoutHeight = constraints.maxHeight
val looseConstraints = constraints.copy(minWidth = 0, minHeight = 0)

val sheetPlaceable = subcompose(BottomSheetScaffoldLayoutSlot.Sheet) {
bottomSheet(layoutHeight)
}[0].measure(looseConstraints)
val sheetOffsetY = sheetOffset().roundToInt()
val sheetOffsetX = Integer.max(0, (layoutWidth - sheetPlaceable.width) / 2)

val topBarPlaceable = topBar?.let {
subcompose(BottomSheetScaffoldLayoutSlot.TopBar) { topBar() }[0]
.measure(looseConstraints)
}
val topBarHeight = topBarPlaceable?.height ?: 0

val sheetPlaceable = subcompose(BottomSheetScaffoldLayoutSlot.Sheet) {
bottomSheet(layoutHeight - topBarHeight)
}[0].measure(looseConstraints.copy(maxHeight = layoutHeight - topBarHeight))
val sheetOffsetY = sheetOffset().roundToInt() + topBarHeight
val sheetOffsetX = Integer.max(0, (layoutWidth - sheetPlaceable.width) / 2)

val bodyConstraints = looseConstraints.copy(maxHeight = layoutHeight - topBarHeight)
val bodyPlaceable = subcompose(BottomSheetScaffoldLayoutSlot.Body) {
Surface(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,9 @@ fun MapScreen(mapViewModel: MapViewModel = hiltViewModel(), onBackPressed: () ->
},
scaffoldState = bottomSheetScaffoldState,
sheetPeekHeight = 40.dp,
sheetExpansionHeight = SheetExpansionHeight(0.5f, 0.9f)
) {
Box {
sheetExpansionHeight = SheetExpansionHeight(0.5f),
topBar = {
val scope = rememberCoroutineScope()
// show the composable map using the mapViewModel
ComposableMap(
modifier = Modifier.fillMaxSize(),
mapState = mapViewModel
)
// show the top bar which changes available actions based on if the FeatureForm is
// being shown and is in edit mode
TopFormBar(
Expand All @@ -96,6 +90,12 @@ fun MapScreen(mapViewModel: MapViewModel = hiltViewModel(), onBackPressed: () ->
onBackPressed()
}
}
) {
// show the composable map using the mapViewModel
ComposableMap(
modifier = Modifier.fillMaxSize(),
mapState = mapViewModel
)
}
// clear focus and hide the keyboard when the bottom sheet is hidden and the keyboard is visible
ClearFocus(
Expand Down Expand Up @@ -150,11 +150,7 @@ fun TopFormBar(
Icon(imageVector = Icons.Default.Check, contentDescription = "Save Feature")
}
}
},
// set the top app bar to 70% opacity
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.surface.copy(alpha = 0.7f)
)
}
)
}

Expand Down