Skip to content

Instantly share code, notes, and snippets.

@arcadefire
Created September 12, 2021 17:13
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 arcadefire/921f8b13ffafcfd84800ff0818592440 to your computer and use it in GitHub Desktop.
Save arcadefire/921f8b13ffafcfd84800ff0818592440 to your computer and use it in GitHub Desktop.
Pre and post fling
override suspend fun onPreFling(available: Velocity): Velocity {
return if (available.y < 0 && scrollState.value == 0) {
swipeableState.performFling(available.y)
available
} else {
Velocity.Zero
}
}
override suspend fun onPostFling(
consumed: Velocity,
available: Velocity
): Velocity {
swipeableState.performFling(velocity = available.y)
return super.onPostFling(consumed, available)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment