I have a full screen ModalBottomSheet (compose material3). The content inside bottomsheet is Lazycolumn. I make it non-dismissable but it is getting dismissed because of the inner scroll in LazyColumn
val state = rememberModalBottomSheetState(
skipPartiallyExpanded = true,
confirmValueChange = {
// Just to prevent the bottom sheet from hiding (Non-dismissible, Non-draggable)
false
},
)
var showBottomSheet by remember { mutableStateOf(false) }
LaunchedEffect(isVisible) {
if (isVisible) {
showBottomSheet = true
} else {
scope.launch {
state.hide()
}.invokeOnCompletion {
showBottomSheet = false
}
}
}
if (showBottomSheet) {
ModalBottomSheet(
sheetState = state,
shape = RoundedCornerShape(topStart = 6.dp, topEnd = 6.dp),
containerColor = Theme.colorScheme.surface,
contentColor = Theme.colorScheme.onSurface,
tonalElevation = 0.dp,
dragHandle = {},
windowInsets = WindowInsets(0, 0, 0, 0),
onDismissRequest = {
},
properties = ModalBottomSheetProperties(
isFocusable = false,
securePolicy = ModalBottomSheetDefaults.properties().securePolicy,
shouldDismissOnBackPress = false,
),
modifier = modifier
.fillMaxWidth()
.constrainScreenWidth()
,
) {
Box(
modifier = Modifier
.fillMaxSize()
)
{
LazyColumn(modifier = Modifier.padding(16.dp)) {
items(100) { index ->
Text("Item #$index", modifier = Modifier.padding(vertical = 4.dp))
}
}
}
}
}
How we can get a non-dismissable bottomsheet with scrollable content
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745613645a4636100.html
评论列表(0条)