Simon Stahl
02/23/2022, 12:04 AMBottomSheetState
when used in BottomSheetScaffold
and decreasing the sheetPeekHeight
. Example code in commentBottomSheetScaffold
where I set the peek height with a slider. I noticed that when the peek height decreases, the BottomSheetState.progress
has wrong valuesfun Greeting() {
var sliderValue by remember { mutableStateOf(0f) }
val bottomSheetState = rememberBottomSheetScaffoldState()
val sheetPeekHeight = 70.dp * (1 - sliderValue)
bottomSheetState.bottomSheetState.progress.let {
Log.e("Simon", "from: ${it.from} to: ${<http://it.to|it.to>} val: ${it.fraction}")
}
BottomSheetScaffold(
sheetContent = {
Text(
modifier = Modifier.height(300.dp).padding(10.dp),
text = "Sheet content"
)
},
scaffoldState = bottomSheetState,
sheetPeekHeight = sheetPeekHeight,
sheetShape = RoundedCornerShape(
topStart = 20.dp,
topEnd = 20.dp
),
sheetBackgroundColor = Color.LightGray
) {
Slider(value = sliderValue, onValueChange = { sliderValue = it })
}
}
from: Collapsed to: Expanded val: 0.0010182378
even though from
and to
should be the same at this point and the fraction
should be 0f
offset
and fraction
are changedSwipeable.findBounds()
is being called at a moment when anchors
and offest
are out of sync?jossiwolf
02/23/2022, 10:24 AMColton Idle
02/23/2022, 7:36 PMSimon Stahl
02/23/2022, 8:05 PMSwipeProgress
in compose itself.Colton Idle
02/23/2022, 9:14 PMSimon Stahl
02/23/2022, 10:56 PMColton Idle
02/23/2022, 11:14 PMSimon Stahl
02/23/2022, 11:14 PMjossiwolf
02/24/2022, 8:20 PM