Skip to content

Instantly share code, notes, and snippets.

@skydoves
Created February 15, 2026 07:18
Show Gist options
  • Select an option

  • Save skydoves/e373d09744d2e75d98c70b5dc6036749 to your computer and use it in GitHub Desktop.

Select an option

Save skydoves/e373d09744d2e75d98c70b5dc6036749 to your computer and use it in GitHub Desktop.
FlexibleBottomSheet - Adaptive content with onTargetChanges
@Composable
fun GoogleMapsSheet(onDismissRequest: () -> Unit) {
var targetValue by remember {
mutableStateOf(FlexibleSheetValue.IntermediatelyExpanded)
}
FlexibleBottomSheet(
onDismissRequest = onDismissRequest,
sheetState = rememberFlexibleBottomSheetState(
flexibleSheetSize = FlexibleSheetSize(
fullyExpanded = 0.9f,
intermediatelyExpanded = 0.5f,
slightlyExpanded = 0.18f,
),
isModal = false,
skipSlightlyExpanded = false,
),
onTargetChanges = { targetValue = it },
containerColor = Color.Black,
) {
when (targetValue) {
FlexibleSheetValue.SlightlyExpanded -> CompactSummary()
FlexibleSheetValue.IntermediatelyExpanded -> DetailedInfo()
FlexibleSheetValue.FullyExpanded -> FullContent()
FlexibleSheetValue.Hidden -> {}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment