Created
June 26, 2023 11:21
-
-
Save PriyaSindkar/643d24348202d0e104b2dd2f45f996bf to your computer and use it in GitHub Desktop.
Standard Bottom Sheet from Material 3
This file contains 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 scope = rememberCoroutineScope() | |
val sheetState = SheetState(skipPartiallyExpanded = false, skipHiddenState = false) | |
val scaffoldState = rememberBottomSheetScaffoldState(bottomSheetState = sheetState) | |
BottomSheetScaffold(modifier = Modifier.fillMaxHeight(), | |
scaffoldState = scaffoldState, | |
sheetPeekHeight = 128.dp, | |
sheetShadowElevation = 32.dp, | |
topBar = { | |
CenterAlignedTopAppBar(title = { Text(text = "Material 3 Demo") }) | |
}, | |
sheetDragHandle = { BottomSheetDefaults.DragHandle(color = Color.RED) }, | |
sheetContent = { | |
BottomSheetContent() | |
}, | |
content = { innerPadding -> | |
Box { | |
ElevatedButton( | |
modifier = Modifier | |
.wrapContentSize() | |
.align(Alignment.Center), | |
onClick = { | |
scope.launch { | |
scaffoldState.bottomSheetState.let { | |
if (it.isVisible) it.hide() else it.show() | |
} | |
} | |
} | |
) { | |
Text(text = "Standard Bottom Sheet") | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment