Sam
12/14/2020, 10:05 PMlazyGridFor that could have multiple columns that don’t require even-height rows, but i’d settle for fully rendering if it’s currently possible https://user-images.githubusercontent.com/29085/56487936-b3bc2c00-6491-11e9-8493-bb89c4f00a92.png▾
Sam
12/14/2020, 10:20 PMLazyVerticalGrid with GridCells.Adaptive which seems exactly what I need, but I’m not able to access it through alpha08. Is it not out until alpha09? https://cs.android.com/androidx/platform/frameworks/support/+/androidx-master-dev:co[…]undation/lazy/LazyGrid.kt;l=88?q=LazyVerticalGrid&ss=androidxSam
12/15/2020, 4:47 AMStaggeredVerticalGrid component but it is a bit too rigid for my needs: https://github.com/android/compose-samples/blob/2cff65334ea023956a58f215a13b6a55c7[…]app/src/main/java/com/example/owl/ui/courses/FeaturedCourses.ktAndrey Kulikov
12/15/2020, 9:56 AMLazyVerticalGrid will not support cells with different height. at least yet. doing staggered grids with lazy is currently untrivial. I would suggest to take a look on the implementation from samples for nowTimo Drick
12/16/2020, 10:07 AMTimo Drick
12/16/2020, 10:16 AMTimo Drick
12/17/2020, 2:23 AMSam
12/17/2020, 2:32 AMLazyColumn which has some quirks that I can live with+adjust for:
LazyColumn {
item { Header("Communities")}
itemsIndexed(communities.chunked(2)) { index, chunk ->
Box(Modifier.padding(bottom = 30.dp)) {
if (index == 0) {
CreateAndExploreButtons()
}
Row(horizontalArrangement = Arrangement.spacedBy(30.dp)) {
chunk.forEachIndexed { i, community ->
CommunityCard(
community = community,
modifier = Modifier
.weight(1f)
.height(200.dp)
.offset(y = if (i % 2 == 0) 0.dp else (68.dp + 30.dp)), // Shift layout of second column
onSelect = onSelect
)
}
if (chunk.count() == 1) {
// Added in case the last row only has one item
Spacer(Modifier.weight(1f))
}
}
}
}
}Sam
12/17/2020, 2:34 AMTimo Drick
12/17/2020, 2:47 AMTimo Drick
12/17/2020, 2:48 AMSam
12/17/2020, 3:35 AMLazyColumn and then offset/push off the top of the screen. It would be even easier if there were the ability to configure extra buffer area so that recycled items are more aggressively renderedTimo Drick
12/17/2020, 3:57 AM