Skip to content

Instantly share code, notes, and snippets.

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 Levi-Moreira/98bac839b25db5853fd8257abaa1990d to your computer and use it in GitHub Desktop.
Save Levi-Moreira/98bac839b25db5853fd8257abaa1990d to your computer and use it in GitHub Desktop.
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
val delta = available.y.toInt()
val newOffset = appBarOffset + delta
val previousOffset = appBarOffset
appBarOffset = newOffset.coerceIn(-appBarMaxHeight, 0)
val consumed = appBarOffset - previousOffset
return Offset(0f, consumed.toFloat())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment