Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
Remove unused code (#944)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Arriola <[email protected]>
  • Loading branch information
Mohammadali Rezaei and arriolac authored Jan 2, 2024
1 parent 40be469 commit ce42744
Showing 1 changed file with 1 addition and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
import androidx.compose.ui.input.nestedscroll.NestedScrollSource
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInWindow
Expand Down Expand Up @@ -178,31 +174,7 @@ fun PlantDetails(
if (toolbarTransitionState == ToolbarState.HIDDEN) 1f else 0f
}

val toolbarHeightPx = with(LocalDensity.current) {
Dimens.PlantDetailAppBarHeight.roundToPx().toFloat()
}
val toolbarOffsetHeightPx = remember { mutableStateOf(0f) }
val nestedScrollConnection = remember {
object : NestedScrollConnection {
override fun onPreScroll(
available: Offset,
source: NestedScrollSource
): Offset {
val delta = available.y
val newOffset = toolbarOffsetHeightPx.value + delta
toolbarOffsetHeightPx.value =
newOffset.coerceIn(-toolbarHeightPx, 0f)
return Offset.Zero
}
}
}

Box(
modifier
.fillMaxSize()
// attach as a parent to the nested scroll system
.nestedScroll(nestedScrollConnection)
) {
Box(modifier.fillMaxSize()) {
PlantDetailsContent(
scrollState = scrollState,
toolbarState = toolbarState,
Expand Down

0 comments on commit ce42744

Please sign in to comment.