Skip to content

Commit

Permalink
Calculate new sheet peek height NestedScrollConnection#onPostScroll
Browse files Browse the repository at this point in the history
… in the home screen (#836)
  • Loading branch information
msasikanth authored Feb 26, 2025
1 parent 9177fa5 commit f8e1621
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,14 @@ internal fun HomeScreen(

val nestedScrollConnection = remember {
object : NestedScrollConnection {
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
val delta = available.y.toInt()
override fun onPostScroll(
consumed: Offset,
available: Offset,
source: NestedScrollSource
): Offset {
val delta = consumed.y.toInt()
val sheetPeekHeightInPx = with(density) { sheetPeekHeight.roundToPx() }
val newSheetPeekHeight = sheetPeekHeightInPx + delta
val newSheetPeekHeight = sheetPeekHeightInPx + delta * 2

sheetPeekHeight =
with(density) {
Expand Down

0 comments on commit f8e1621

Please sign in to comment.