@@ -42,6 +42,7 @@ import androidx.compose.ui.graphics.Shape
42
42
import androidx.compose.ui.input.nestedscroll.nestedScroll
43
43
import androidx.compose.ui.layout.Layout
44
44
import androidx.compose.ui.layout.onGloballyPositioned
45
+ import androidx.compose.ui.platform.LocalConfiguration
45
46
import androidx.compose.ui.platform.LocalDensity
46
47
import androidx.compose.ui.semantics.collapse
47
48
import androidx.compose.ui.semantics.expand
@@ -61,14 +62,15 @@ fun rememberBottomDrawerScaffoldState(
61
62
confirmValueChange : (newValue: BottomDrawerValue ) -> Boolean = { true }
62
63
): AnchoredDraggableState <BottomDrawerValue > {
63
64
val density = LocalDensity .current
65
+ val maxHeight = with (density) { LocalConfiguration .current.screenHeightDp.dp.toPx() }
64
66
return remember {
65
67
AnchoredDraggableState (
66
68
initialValue = initialValue,
67
69
positionalThreshold = positionalThreshold,
68
70
velocityThreshold = velocityThreshold ? : { with (density) { 100 .dp.toPx() } },
69
71
animationSpec = animationSpec,
70
72
anchors = DraggableAnchors {
71
- BottomDrawerValue .Collapsed at 0f
73
+ BottomDrawerValue .Collapsed at maxHeight
72
74
BottomDrawerValue .Expanded at 0f
73
75
},
74
76
confirmValueChange = confirmValueChange
@@ -86,9 +88,7 @@ fun BottomDrawerScaffold(
86
88
bottomBar : @Composable (() -> Unit )? = null,
87
89
gesturesEnabled : Boolean = true,
88
90
drawerModifier : Modifier = Modifier ,
89
- // snackbarHostState: SnackbarHostState,
90
91
snackbarHost : @Composable () -> Unit = {},
91
- // snackbarHost: @Composable (SnackbarHostState) -> Unit = { SnackbarHost(it) },
92
92
floatingActionButton : @Composable (() -> Unit )? = null,
93
93
floatingActionButtonPosition : FabPosition = FabPosition .End ,
94
94
drawerGesturesEnabled : Boolean? = null,
@@ -143,7 +143,7 @@ fun BottomDrawerScaffold(
143
143
144
144
val anchoredDraggableModifier = Modifier
145
145
.nestedScroll(
146
- bottomDrawerScaffoldState.createPreUpPostDownNestedScrollConnection()
146
+ bottomDrawerScaffoldState.createPreUpPostDownNestedScrollConnection(topPadding.toInt() )
147
147
)
148
148
.anchoredDraggable(
149
149
state = bottomDrawerScaffoldState,
0 commit comments