gpt4 book ai didi

android - 为什么我的bottomSheet 来自jetpack compose 中的屏幕顶部

转载 作者:行者123 更新时间:2023-12-05 00:02:27 27 4
gpt4 key购买 nike

我有一个bottomSheet,但是当屏幕显示时它从屏幕顶部到底部。我该如何解决?
这是我的 Bottom Sheet 代码:

@ExperimentalMaterialApi
@Composable
fun BottomSheet(
modifier: Modifier = Modifier,
buttonText: String,
composable: @Composable () -> Unit,
scope: CoroutineScope
) {
val bottomSheetScaffoldState = rememberBottomSheetScaffoldState(
bottomSheetState = BottomSheetState(BottomSheetValue.Expanded)
)
BottomSheetScaffold(
scaffoldState = bottomSheetScaffoldState,
sheetContent = {
Column(
Modifier
.fillMaxWidth()
.height(200.dp)
.padding(8.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {

Button(colors = ButtonDefaults.buttonColors(
backgroundColor = AppColor.brandColor.BLUE_DE_FRANCE,
contentColor = AppColor.neutralColor.DOCTOR
),
shape = RoundedCornerShape(
small
),
onClick = {
scope.launch {
bottomSheetScaffoldState.bottomSheetState.collapse()
}
}) {
}
}
},
sheetPeekHeight = 0.dp,
sheetShape = RoundedCornerShape(topEnd = medium, topStart = medium)
) {
composable()
}

}
可组合功能是谷歌地图屏幕

最佳答案

我的问题仅在预览中。当以交互方式或在模拟器中运行它时,它工作正常。如果你还没有,也许试试这个。

关于android - 为什么我的bottomSheet 来自jetpack compose 中的屏幕顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69733802/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com