Skip to content

Instantly share code, notes, and snippets.

View skydoves's full-sized avatar
💡
Practice is the only shortcut

Jaewoong Eum skydoves

💡
Practice is the only shortcut
View GitHub Profile
@skydoves
skydoves / PlaceDetailScreen.kt
Created February 15, 2026 07:19
FlexibleBottomSheet - Complete Google Maps style PlaceDetailScreen
@Composable
fun PlaceDetailScreen() {
var targetValue by remember {
mutableStateOf(FlexibleSheetValue.SlightlyExpanded)
}
Box(modifier = Modifier.fillMaxSize()) {
// Map content behind the sheet
MapView(modifier = Modifier.fillMaxSize())
@skydoves
skydoves / InitialState.kt
Created February 15, 2026 07:19
FlexibleBottomSheet - Setting initial state
rememberFlexibleBottomSheetState(
initialValue = FlexibleSheetValue.SlightlyExpanded,
isModal = false,
skipSlightlyExpanded = false,
)
@skydoves
skydoves / WrapContentMode.kt
Created February 15, 2026 07:19
FlexibleBottomSheet - Wrap content mode
rememberFlexibleBottomSheetState(
flexibleSheetSize = FlexibleSheetSize(
fullyExpanded = FlexibleSheetSize.WrapContent,
intermediatelyExpanded = 0.5f,
slightlyExpanded = FlexibleSheetSize.WrapContent,
),
isModal = false,
skipSlightlyExpanded = false,
)
@skydoves
skydoves / NestedScrolling.kt
Created February 15, 2026 07:18
FlexibleBottomSheet - Nested scrolling with LazyVerticalGrid
FlexibleBottomSheet(
onDismissRequest = onDismissRequest,
sheetState = rememberFlexibleBottomSheetState(
flexibleSheetSize = FlexibleSheetSize(
fullyExpanded = 0.9f,
intermediatelyExpanded = 0.5f,
slightlyExpanded = 0.18f,
),
isModal = false,
skipSlightlyExpanded = false,
@skydoves
skydoves / ConfirmValueChange.kt
Created February 15, 2026 07:18
FlexibleBottomSheet - Vetoing state changes with confirmValueChange
rememberFlexibleBottomSheetState(
confirmValueChange = { newValue ->
newValue != FlexibleSheetValue.Hidden
},
)
@skydoves
skydoves / ReadingState.kt
Created February 15, 2026 07:18
FlexibleBottomSheet - Reading state properties
val isSheetVisible = sheetState.isVisible
val currentState = sheetState.currentValue
val targetState = sheetState.targetValue
@skydoves
skydoves / ShowWithTarget.kt
Created February 15, 2026 07:18
FlexibleBottomSheet - Show with specific target
scope.launch { sheetState.show(FlexibleSheetValue.SlightlyExpanded) }
@skydoves
skydoves / ProgrammaticControl.kt
Created February 15, 2026 07:18
FlexibleBottomSheet - Programmatic state control
val sheetState = rememberFlexibleBottomSheetState(
isModal = false,
skipSlightlyExpanded = false,
)
val scope = rememberCoroutineScope()
// Expand to full height
Button(onClick = { scope.launch { sheetState.fullyExpand() } }) {
Text("Expand")
}
@skydoves
skydoves / AdaptiveText.kt
Created February 15, 2026 07:18
FlexibleBottomSheet - Adaptive text with maxLines
Text(
text = "Central Park, New York",
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
maxLines = if (targetValue == FlexibleSheetValue.SlightlyExpanded) 1 else 3,
overflow = TextOverflow.Ellipsis,
color = Color.White,
)
@skydoves
skydoves / AdaptiveContent.kt
Created February 15, 2026 07:18
FlexibleBottomSheet - Adaptive content with onTargetChanges
@Composable
fun GoogleMapsSheet(onDismissRequest: () -> Unit) {
var targetValue by remember {
mutableStateOf(FlexibleSheetValue.IntermediatelyExpanded)
}
FlexibleBottomSheet(
onDismissRequest = onDismissRequest,
sheetState = rememberFlexibleBottomSheetState(
flexibleSheetSize = FlexibleSheetSize(