This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun PlaceDetailScreen() { | |
| var targetValue by remember { | |
| mutableStateOf(FlexibleSheetValue.SlightlyExpanded) | |
| } | |
| Box(modifier = Modifier.fillMaxSize()) { | |
| // Map content behind the sheet | |
| MapView(modifier = Modifier.fillMaxSize()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rememberFlexibleBottomSheetState( | |
| initialValue = FlexibleSheetValue.SlightlyExpanded, | |
| isModal = false, | |
| skipSlightlyExpanded = false, | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rememberFlexibleBottomSheetState( | |
| flexibleSheetSize = FlexibleSheetSize( | |
| fullyExpanded = FlexibleSheetSize.WrapContent, | |
| intermediatelyExpanded = 0.5f, | |
| slightlyExpanded = FlexibleSheetSize.WrapContent, | |
| ), | |
| isModal = false, | |
| skipSlightlyExpanded = false, | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FlexibleBottomSheet( | |
| onDismissRequest = onDismissRequest, | |
| sheetState = rememberFlexibleBottomSheetState( | |
| flexibleSheetSize = FlexibleSheetSize( | |
| fullyExpanded = 0.9f, | |
| intermediatelyExpanded = 0.5f, | |
| slightlyExpanded = 0.18f, | |
| ), | |
| isModal = false, | |
| skipSlightlyExpanded = false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rememberFlexibleBottomSheetState( | |
| confirmValueChange = { newValue -> | |
| newValue != FlexibleSheetValue.Hidden | |
| }, | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val isSheetVisible = sheetState.isVisible | |
| val currentState = sheetState.currentValue | |
| val targetState = sheetState.targetValue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scope.launch { sheetState.show(FlexibleSheetValue.SlightlyExpanded) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val sheetState = rememberFlexibleBottomSheetState( | |
| isModal = false, | |
| skipSlightlyExpanded = false, | |
| ) | |
| val scope = rememberCoroutineScope() | |
| // Expand to full height | |
| Button(onClick = { scope.launch { sheetState.fullyExpand() } }) { | |
| Text("Expand") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun GoogleMapsSheet(onDismissRequest: () -> Unit) { | |
| var targetValue by remember { | |
| mutableStateOf(FlexibleSheetValue.IntermediatelyExpanded) | |
| } | |
| FlexibleBottomSheet( | |
| onDismissRequest = onDismissRequest, | |
| sheetState = rememberFlexibleBottomSheetState( | |
| flexibleSheetSize = FlexibleSheetSize( |
NewerOlder