From 7eea746c2b41dc40a21916c3325b0082487a7025 Mon Sep 17 00:00:00 2001 From: Ali Rezaei Date: Sat, 30 Dec 2023 04:53:53 -0800 Subject: [PATCH] Remove unused code --- .../compose/plantdetail/PlantDetailView.kt | 30 +------------------ 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/app/src/main/java/com/google/samples/apps/sunflower/compose/plantdetail/PlantDetailView.kt b/app/src/main/java/com/google/samples/apps/sunflower/compose/plantdetail/PlantDetailView.kt index f74e93cbe..e1325c7d1 100644 --- a/app/src/main/java/com/google/samples/apps/sunflower/compose/plantdetail/PlantDetailView.kt +++ b/app/src/main/java/com/google/samples/apps/sunflower/compose/plantdetail/PlantDetailView.kt @@ -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 @@ -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,