现在在新的 API 中,animateTo 方法无法使用。如何使用自定义动画时间平滑地 animateTo 到某个状态?
现在我们可以使用 AnimationSpec 作为默认动画时间。
val animationSpec = remember {
Animatable(0f)
.run {
TweenSpec<Float>(durationMillis = 300)
}
}
and then
val sheetScaffoldState = rememberModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
skipHalfExpanded = true,
animationSpec = animationSpec
)
现在简单地调用 show() 或 hide(),就像这样
scope.launch {
sheetScaffoldState.hide()
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)