You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem?
I want to use the progress of the visibility to dynamically update some contents
Describe the solution you'd like:
FlexibleSheetState would contain a state property progress : State<Float>.
0f would mean the bottom sheet is Hidden
1f would mean the bottom sheet is FullyExpanded
This progress would update whenever an automatic animation occurs or when the user drags the bottom sheet up or down.
Describe alternatives you've considered:
Manually calculation the bottom sheet visible height. And doing approximated calculations.
The text was updated successfully, but these errors were encountered:
onTargetChanges passes FlexibleSheetValue which is an enum with the discrete defined values. What I mentioned is the full range. This is the code I'm using for now to accomplish this.
// Full screen heightval screenHeightPx =with(LocalDensity.current) { LocalConfiguration.current.screenHeightDp.dp.toPx() }
val fullyExpanded:Float=1f/** * Offset related to the bottom sheet offset * Offset: 0 when Fully expanded * Offset: ScreenHeight when Fully Hidden*/val offsetPx by rememberUpdatedState(
try {
sheetState.requireOffset()
} catch (ex:IllegalStateException) {
screenHeightPx
},
)
val progress =when (screenHeightPx) {
0f->0felse-> (screenHeightPx - offsetPx) / screenHeightPx
}.coerceIn(0f, 1f)
Is your feature request related to a problem?
I want to use the progress of the visibility to dynamically update some contents
Describe the solution you'd like:
FlexibleSheetState would contain a state property
progress : State<Float>
.0f would mean the bottom sheet is
Hidden
1f would mean the bottom sheet is
FullyExpanded
This progress would update whenever an automatic animation occurs or when the user drags the bottom sheet up or down.
Describe alternatives you've considered:
Manually calculation the bottom sheet visible height. And doing approximated calculations.
The text was updated successfully, but these errors were encountered: