我想做一个类似物流的一个页面类似下图,但是左边那条绿线无法显示出来。(代码和图片在后面)
Row(modifier = Modifier.height(IntrinsicSize.Min)) 并且把图片 grid 注释掉,那么绿线是正常显示的
Row(modifier = Modifier.fillMaxHeight) 并且设置 grid 的 height ,也无法显示

@Composable
fun ListDemo() {
var titles = listOf("1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2")
LazyColumn(modifier = Modifier
.fillMaxSize()) {
itemsIndexed(titles) { index, item ->
Surface(modifier = Modifier
.fillMaxWidth()) {
Column(modifier = Modifier
.padding(horizontal = 18.dp)) {
Row(modifier = Modifier
.padding(vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically) {
Box(modifier = Modifier
.size(24.dp)
.background(Color.Red))
}
Row(modifier = Modifier
.fillMaxWidth()) {
Box(modifier = Modifier
.width(24.dp)
.fillMaxHeight(IntrinsicSize.Min),
contentAlignment = Alignment.Center){
// TODO show this green line
Box(modifier = Modifier
.fillMaxHeight()
.width(1.dp)
.background(Color.Green))
}
Spacer(Modifier.width(8.dp))
Column(modifier = Modifier
.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(8.dp)) {
Row(modifier = Modifier
.fillMaxWidth()) {
Text(
text = "Time:",
fontSize = 14.sp,
color = Color.Gray,
modifier = Modifier
.width(100.dp)
)
Spacer(Modifier.width(4.dp))
Text(
text = "2023-03-02 18:34:07",
fontSize = 14.sp,
color = Color.Gray
)
}
val images = listOf("1","2","3","4")
LazyVerticalGrid(
columns = GridCells.Fixed(3),
horizontalArrangement = Arrangement.spacedBy(6.dp),
verticalArrangement = Arrangement.spacedBy(6.dp),
modifier = Modifier.heightIn(
max = 1000.dp)
) {
items(images) { pic ->
Box(
modifier = Modifier
.aspectRatio(1f)
.background(Color.Gray)
) {
Text(
text = pic
)
}
}
}
}
}
Spacer(Modifier.height(8.dp))
}
}
}
}
}
@Preview
@Composable
fun ListDemoPreview() {
ListDemo()
}
|