File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
grid/src/commonMain/kotlin/com/cheonjaeung/compose/grid Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -118,9 +118,6 @@ private class HorizontalVerticalGridMeasureHelper(
118118 measurables[it].parentData as ? HorizontalVerticalGridParentData
119119 }
120120
121- private val HorizontalVerticalGridParentData ?.spanOrDefault: (GridItemSpanScope .() -> Int )
122- get() = this ?.span ? : HorizontalVerticalGridParentData .DefaultSpan
123-
124121 /* *
125122 * Measures children composable constraints.
126123 */
@@ -158,9 +155,14 @@ private class HorizontalVerticalGridMeasureHelper(
158155 maxCurrentLineSpan = maxSpan - spanSum,
159156 maxLineSpan = maxSpan
160157 )
161- val scopeFunction = gridParentDataArrays[measurableIndex].spanOrDefault
162- val span = scopeFunction(spanScope)
158+ val spanFunction = gridParentDataArrays[measurableIndex]?.span
159+ val span = if (spanFunction != null ) {
160+ with (spanScope) { spanFunction() }
161+ } else {
162+ 1
163+ }
163164 require(span > 0 ) { " span must be bigger than zero, $span is zero or negative" }
165+
164166 if (span > maxSpan) {
165167 measurableIndex++
166168 continue
You can’t perform that action at this time.
0 commit comments