Skip to content

Instantly share code, notes, and snippets.

@ahmedrizwan
Created May 27, 2020 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmedrizwan/fcd99c548d3ba638c6b8ae989f954d98 to your computer and use it in GitHub Desktop.
Save ahmedrizwan/fcd99c548d3ba638c6b8ae989f954d98 to your computer and use it in GitHub Desktop.
// Top drag
val topStart = -(constraints.maxHeight.value / 1.4f)
val topMax = 0.dp
val topMin = -(boxHeight / 1.4f)
val (topMinPx, topMaxPx) = with(DensityAmbient.current) {
topMin.toPx().value to topMax.toPx().value
}
val topFlingConfig = AnchorsFlingConfig(listOf(topMinPx, topMaxPx))
val topPosition = animatedFloat(topStart) // for dragging state
topPosition.setBounds(topMinPx, topMaxPx)
val topDrag = Drag(
position = topPosition,
flingConfig = topFlingConfig
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment