admin管理员组文章数量:1434380
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
本文标签: JetPack Compose ModalBottomSheet FullScreenStack Overflow
版权声明:本文标题:JetPack Compose ModalBottomSheet FullScreen - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745613645a2666265.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论