The link is the image that contains the layout diagram I want to output using the Lazy Vertical Grid in jetpack compose. However, I don't know why I don't have a span argument in my item()/items() inside the LazyVerticalGrid.
Here is my code,
LazyVerticalGrid(
cells = GridCells.Fixed(2),
modifier = Modifier
.background(Color.Black)
.padding(start = 20.dp, end = 20.dp, top = 20.dp),
verticalArrangement = Arrangement.spacedBy(20.dp),
horizontalArrangement = Arrangement.spacedBy(20.dp),
content = {
item (span = {
GridItemSpan(maxLineSpan)
}) {
//Text header
}
}
)
}
Error: "Cannot find the parameter with this name: span"
CodePudding user response:
There are two things you can check:
Make sure you have a current compose version. The releasenotes seem to indicate you need at least Version 1.1.0-beta03
Make sure you have the correct imports. (You might have imported the list version etc.)
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.items