I want to set a transparent background for bottomsheetscaffold in the jetpack compose but when I launch the app, the background is the default. how can I set a black transparent background to the jetpack compose bottom sheet? (Like BottomSheetDialogFragment in the xml)?
@Composable
fun BottomSheet(
modifier: Modifier = Modifier,
title: String,
content: String,
buttonText: String,
composable: @Composable () -> Unit,
isOpen: (Boolean) -> Unit
) {
val coroutineScope = rememberCoroutineScope()
val bottomSheetScaffoldState = rememberBottomSheetScaffoldState(
bottomSheetState = BottomSheetState(BottomSheetValue.Expanded)
)
BottomSheetScaffold(
sheetBackgroundColor = Color.Transparent,
scaffoldState = bottomSheetScaffoldState,
sheetGesturesEnabled = false,
sheetContent = {
Column(
Modifier
.fillMaxWidth()
.padding(8.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = title,
style = AppFont.PoppinsTypography.button
)
Spacer(modifier = modifier.size(8.dp))
Text(
text = content,
style = AppFont.PoppinsTypography.body1
)
Spacer(modifier = modifier.size(16.dp))
Button(colors = ButtonDefaults.buttonColors(
backgroundColor = AppColor.brandColor.BLUE_DE_FRANCE,
contentColor = AppColor.neutralColor.DOCTOR
),
shape = RoundedCornerShape(
small
),
onClick = {
coroutineScope.launch {
bottomSheetScaffoldState.bottomSheetState.collapse()
isOpen.invoke(false)
}
}) {
Text(
text = buttonText,
style = AppFont.PoppinsTypography.button
)
}
}
},
sheetShape = RoundedCornerShape(topEnd = medium, topStart = medium),
sheetPeekHeight = 0.dp,
drawerGesturesEnabled = false
) {
composable()
}
}