Skip to content

Commit d4da255

Browse files
authored
Form content clipping fix (#89)
* added measure and placement constraints for the bottomsheetscaffold * removed transparent top bar :(
1 parent e095665 commit d4da255

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

microapps/FeatureFormsApp/app/src/main/java/com/arcgismaps/toolkit/featureformsapp/screens/bottomsheet/BottomSheetScaffold.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,18 @@ private fun BottomSheetScaffoldLayout(
354354
val layoutHeight = constraints.maxHeight
355355
val looseConstraints = constraints.copy(minWidth = 0, minHeight = 0)
356356

357-
val sheetPlaceable = subcompose(BottomSheetScaffoldLayoutSlot.Sheet) {
358-
bottomSheet(layoutHeight)
359-
}[0].measure(looseConstraints)
360-
val sheetOffsetY = sheetOffset().roundToInt()
361-
val sheetOffsetX = Integer.max(0, (layoutWidth - sheetPlaceable.width) / 2)
362-
363357
val topBarPlaceable = topBar?.let {
364358
subcompose(BottomSheetScaffoldLayoutSlot.TopBar) { topBar() }[0]
365359
.measure(looseConstraints)
366360
}
367361
val topBarHeight = topBarPlaceable?.height ?: 0
368362

363+
val sheetPlaceable = subcompose(BottomSheetScaffoldLayoutSlot.Sheet) {
364+
bottomSheet(layoutHeight - topBarHeight)
365+
}[0].measure(looseConstraints.copy(maxHeight = layoutHeight - topBarHeight))
366+
val sheetOffsetY = sheetOffset().roundToInt() + topBarHeight
367+
val sheetOffsetX = Integer.max(0, (layoutWidth - sheetPlaceable.width) / 2)
368+
369369
val bodyConstraints = looseConstraints.copy(maxHeight = layoutHeight - topBarHeight)
370370
val bodyPlaceable = subcompose(BottomSheetScaffoldLayoutSlot.Body) {
371371
Surface(

microapps/FeatureFormsApp/app/src/main/java/com/arcgismaps/toolkit/featureformsapp/screens/map/MapScreen.kt

+9-13
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,9 @@ fun MapScreen(mapViewModel: MapViewModel = hiltViewModel(), onBackPressed: () ->
7474
},
7575
scaffoldState = bottomSheetScaffoldState,
7676
sheetPeekHeight = 40.dp,
77-
sheetExpansionHeight = SheetExpansionHeight(0.5f, 0.9f)
78-
) {
79-
Box {
77+
sheetExpansionHeight = SheetExpansionHeight(0.5f),
78+
topBar = {
8079
val scope = rememberCoroutineScope()
81-
// show the composable map using the mapViewModel
82-
ComposableMap(
83-
modifier = Modifier.fillMaxSize(),
84-
mapState = mapViewModel
85-
)
8680
// show the top bar which changes available actions based on if the FeatureForm is
8781
// being shown and is in edit mode
8882
TopFormBar(
@@ -96,6 +90,12 @@ fun MapScreen(mapViewModel: MapViewModel = hiltViewModel(), onBackPressed: () ->
9690
onBackPressed()
9791
}
9892
}
93+
) {
94+
// show the composable map using the mapViewModel
95+
ComposableMap(
96+
modifier = Modifier.fillMaxSize(),
97+
mapState = mapViewModel
98+
)
9999
}
100100
// clear focus and hide the keyboard when the bottom sheet is hidden and the keyboard is visible
101101
ClearFocus(
@@ -150,11 +150,7 @@ fun TopFormBar(
150150
Icon(imageVector = Icons.Default.Check, contentDescription = "Save Feature")
151151
}
152152
}
153-
},
154-
// set the top app bar to 70% opacity
155-
colors = TopAppBarDefaults.topAppBarColors(
156-
containerColor = MaterialTheme.colorScheme.surface.copy(alpha = 0.7f)
157-
)
153+
}
158154
)
159155
}
160156

0 commit comments

Comments
 (0)