I want to add a head item to my LazyVerticalGrid, but without it being wrapped inside the ElevatedCard. Here is my code:
@Composable
fun AppGrid(
apps: List<CommonApp>,
hybridApps: List<TagWithHybridAppList>,
newsData: List<String>,
appSwitch: Boolean,
onSwitchClick: () -> Unit,
onAppItemClick: (Any) -> Unit
) {
ElevatedCard(
elevation = CardDefaults.cardElevation(
defaultElevation = 6.dp
),
modifier = Modifier
.padding(10.dp, 15.dp, 10.dp, 10.dp)
.background(LColors.White)
) {
LazyVerticalGrid(
columns = GridCells.Fixed(4),
modifier = Modifier
.padding(10.dp)
.fillMaxWidth()
.height(if (appSwitch) 1300.dp else 80.dp)
) {
if (newsData.isNotEmpty()) {
item(span = { GridItemSpan(maxLineSpan) }) {
LBanner(bannerData = newsData)
}
}
if (apps.isNotEmpty()) {
items(apps) { app ->
MyApp(app, onAppItemClick)
}
item {
AppSwitchBtn(switch = appSwitch, onClick = {
onSwitchClick()
})
}
}
}
While this code achieves the purpose of scrolling together with the grid content, it is also wrapped within the background of the card. I only need MyApp and AppSwitchBtn to be wrapped inside the Card.