列消失 LazyColumn 变得可滚动

Column disappears LazyColumn gets scrollable

如果满足特定条件,我想在 LazyColumn 下创建一个 Column。当我的 LazyColumn 只有几个项目可用时,此列按预期显示。但是当 LazyColumn 获得足够多的项目可以滚动时,Column 就会消失。它也不在列表的底部,它消失了(或在 LazyColumn 后面?什么没有任何意义)。

我漏掉了什么地方吗?

Column(
        modifier = Modifier.fillMaxSize(),
        verticalArrangement = Arrangement.SpaceBetween
    ) {
        val tasks =
            viewModel.filteredTasks.value
        Log.d(TAG, "Assigned Tasks: ${tasks.size}")
        Log.d(TAG, "Active Task: ${viewModel.activeTask.value}")
        if (tasks.isNullOrEmpty()) {
            Column(
                modifier = Modifier.fillMaxSize(),
                verticalArrangement = Arrangement.Center,
                horizontalAlignment = Alignment.CenterHorizontally
            ) {
                Text("Keine Aufträge vorhanden")
            }
        } else {
            LazyColumn {
                items(tasks.size) { index ->
                    Column {
                        ListItem(
                            modifier = Modifier
                                .padding(bottom = 8.dp)
                                .clickable {
                                    viewModel.taskDetailId =
                                        tasks[index].montageTaskId
                                    findNavController().navigate(R.id.action_task_list_to_details)
                                },
                            text = {
                                Text(text = "Auftragsnummer: ${tasks[index].montageTaskId}")
                            },
                            secondaryText = {
                                Column {
                                    Text(
                                        text = stringResource(
                                            R.string.owner_string,
                                            tasks[index].locationOwner?.companyName
                                                ?: "Empty..."
                                        )
                                    )
                                    Text(
                                        text = stringResource(
                                            R.string.adress_string,
                                            tasks[index].location.street,
                                            tasks[index].location.number
                                        ),
                                    )
                                }
                            },
                            trailing = {
                                Icon(
                                    imageVector = Icons.Default.KeyboardArrowRight,
                                    contentDescription = "Pfeil nach rechts"
                                )
                            }
                        )
                        Divider()
                    }
                }
            }
        }
        if (viewModel.hasActiveTask.value) {
            Column(
                modifier = Modifier
                    .background(MaterialTheme.colors.primary)
                    .fillMaxWidth()
                    .padding(8.dp)
                    .clickable { navigateToActivity(viewModel.taskDetailId) }
            ) {
                Divider(
                    thickness = 1.dp
                )
                Text(text = "Aktiver Auftrag")
                Text(text = "Something Something")
            }
        }
    }

我按照 并通过向您的 LazyColumn 添加 weight(1f) 修饰符解决了问题。