Bump compose dependency
This commit is contained in:
parent
6abe789c2f
commit
400b47f6bd
2 changed files with 22 additions and 11 deletions
|
@ -25,11 +25,12 @@ import androidx.compose.foundation.lazy.LazyMeasuredItem
|
||||||
import androidx.compose.foundation.lazy.LazyMeasuredItemProvider
|
import androidx.compose.foundation.lazy.LazyMeasuredItemProvider
|
||||||
import androidx.compose.foundation.lazy.layout.LazyLayout
|
import androidx.compose.foundation.lazy.layout.LazyLayout
|
||||||
import androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScope
|
import androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScope
|
||||||
|
import androidx.compose.foundation.lazy.layout.lazyLayoutSemantics
|
||||||
import androidx.compose.foundation.lazy.lazyListBeyondBoundsModifier
|
import androidx.compose.foundation.lazy.lazyListBeyondBoundsModifier
|
||||||
import androidx.compose.foundation.lazy.lazyListPinningModifier
|
import androidx.compose.foundation.lazy.lazyListPinningModifier
|
||||||
import androidx.compose.foundation.lazy.lazyListSemantics
|
|
||||||
import androidx.compose.foundation.lazy.measureLazyList
|
import androidx.compose.foundation.lazy.measureLazyList
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListItemProvider
|
import androidx.compose.foundation.lazy.rememberLazyListItemProvider
|
||||||
|
import androidx.compose.foundation.lazy.rememberLazyListSemanticState
|
||||||
import androidx.compose.foundation.overscroll
|
import androidx.compose.foundation.overscroll
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
@ -83,17 +84,22 @@ internal fun ReorderingLazyList(
|
||||||
placementAnimator
|
placementAnimator
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val semanticState = rememberLazyListSemanticState(
|
||||||
|
reorderingState.lazyListState,
|
||||||
|
itemProvider,
|
||||||
|
reverseLayout,
|
||||||
|
isVertical
|
||||||
|
)
|
||||||
|
|
||||||
val orientation = if (isVertical) Orientation.Vertical else Orientation.Horizontal
|
val orientation = if (isVertical) Orientation.Vertical else Orientation.Horizontal
|
||||||
LazyLayout(
|
LazyLayout(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.then(reorderingState.lazyListState.remeasurementModifier)
|
.then(reorderingState.lazyListState.remeasurementModifier)
|
||||||
.then(reorderingState.lazyListState.awaitLayoutModifier)
|
.then(reorderingState.lazyListState.awaitLayoutModifier)
|
||||||
.lazyListSemantics(
|
.lazyLayoutSemantics(
|
||||||
itemProvider = itemProvider,
|
itemProvider = itemProvider,
|
||||||
state = reorderingState.lazyListState,
|
state = semanticState,
|
||||||
coroutineScope = reorderingState.coroutineScope,
|
orientation = orientation,
|
||||||
isVertical = isVertical,
|
|
||||||
reverseScrolling = reverseLayout,
|
|
||||||
userScrollEnabled = userScrollEnabled
|
userScrollEnabled = userScrollEnabled
|
||||||
)
|
)
|
||||||
.clipScrollableContainer(orientation)
|
.clipScrollableContainer(orientation)
|
||||||
|
@ -191,12 +197,16 @@ private fun rememberLazyListMeasurePolicy(
|
||||||
val contentConstraints =
|
val contentConstraints =
|
||||||
containerConstraints.offset(-totalHorizontalPadding, -totalVerticalPadding)
|
containerConstraints.offset(-totalHorizontalPadding, -totalVerticalPadding)
|
||||||
|
|
||||||
|
state.updateScrollPositionIfTheFirstItemWasMoved(itemProvider)
|
||||||
|
|
||||||
// Update the state's cached Density
|
// Update the state's cached Density
|
||||||
state.density = this
|
state.density = this
|
||||||
|
|
||||||
// this will update the scope used by the item composables
|
// this will update the scope used by the item composables
|
||||||
itemProvider.itemScope.maxWidth = contentConstraints.maxWidth.toDp()
|
itemProvider.itemScope.setMaxSize(
|
||||||
itemProvider.itemScope.maxHeight = contentConstraints.maxHeight.toDp()
|
width = contentConstraints.maxWidth,
|
||||||
|
height = contentConstraints.maxHeight
|
||||||
|
)
|
||||||
|
|
||||||
val spaceBetweenItemsDp = if (isVertical) {
|
val spaceBetweenItemsDp = if (isVertical) {
|
||||||
requireNotNull(verticalArrangement).spacing
|
requireNotNull(verticalArrangement).spacing
|
||||||
|
@ -265,6 +275,7 @@ private fun rememberLazyListMeasurePolicy(
|
||||||
mainAxisAvailableSize = mainAxisAvailableSize,
|
mainAxisAvailableSize = mainAxisAvailableSize,
|
||||||
beforeContentPadding = beforeContentPadding,
|
beforeContentPadding = beforeContentPadding,
|
||||||
afterContentPadding = afterContentPadding,
|
afterContentPadding = afterContentPadding,
|
||||||
|
spaceBetweenItems = spaceBetweenItems,
|
||||||
firstVisibleItemIndex = firstVisibleItemIndex,
|
firstVisibleItemIndex = firstVisibleItemIndex,
|
||||||
firstVisibleItemScrollOffset = firstVisibleScrollOffset,
|
firstVisibleItemScrollOffset = firstVisibleScrollOffset,
|
||||||
scrollToBeConsumed = state.scrollToBeConsumed,
|
scrollToBeConsumed = state.scrollToBeConsumed,
|
||||||
|
|
|
@ -11,14 +11,14 @@ dependencyResolutionManagement {
|
||||||
|
|
||||||
versionCatalogs {
|
versionCatalogs {
|
||||||
create("libs") {
|
create("libs") {
|
||||||
version("kotlin", "1.7.10")
|
version("kotlin", "1.7.20")
|
||||||
plugin("kotlin-serialization","org.jetbrains.kotlin.plugin.serialization").versionRef("kotlin")
|
plugin("kotlin-serialization","org.jetbrains.kotlin.plugin.serialization").versionRef("kotlin")
|
||||||
|
|
||||||
library("kotlin-coroutines","org.jetbrains.kotlinx", "kotlinx-coroutines-core").version("1.6.4")
|
library("kotlin-coroutines","org.jetbrains.kotlinx", "kotlinx-coroutines-core").version("1.6.4")
|
||||||
|
|
||||||
version("compose-compiler", "1.3.0")
|
version("compose-compiler", "1.3.2")
|
||||||
|
|
||||||
version("compose", "1.3.0-alpha03")
|
version("compose", "1.3.0-rc01")
|
||||||
library("compose-foundation", "androidx.compose.foundation", "foundation").versionRef("compose")
|
library("compose-foundation", "androidx.compose.foundation", "foundation").versionRef("compose")
|
||||||
library("compose-ui", "androidx.compose.ui", "ui").versionRef("compose")
|
library("compose-ui", "androidx.compose.ui", "ui").versionRef("compose")
|
||||||
library("compose-ui-util", "androidx.compose.ui", "ui-util").versionRef("compose")
|
library("compose-ui-util", "androidx.compose.ui", "ui-util").versionRef("compose")
|
||||||
|
|
Loading…
Reference in a new issue