fix: 修复DetailedAnalysisReport中嵌套LazyColumn导致的崩溃

- 将DetailedAnalysisReport中的LazyColumn改为Column
- 移除所有item{}包装,直接使用普通组件布局
- 解决'Vertically scrollable component was measured with an infinity maximum height constraints'错误

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
yovinchen 2025-07-20 00:20:59 +08:00
parent 74cc6f36a9
commit 562617ca11

View File

@ -54,67 +54,59 @@ fun DetailedAnalysisReport(
val totalIncome = incomeRecords.sumOf { it.amount } val totalIncome = incomeRecords.sumOf { it.amount }
val totalExpense = expenseRecords.sumOf { it.amount } val totalExpense = expenseRecords.sumOf { it.amount }
LazyColumn( Column(
modifier = modifier, modifier = modifier,
verticalArrangement = Arrangement.spacedBy(16.dp) verticalArrangement = Arrangement.spacedBy(16.dp)
) { ) {
// 时间范围标题 // 时间范围标题
item { Card(
Card( modifier = Modifier.fillMaxWidth(),
modifier = Modifier.fillMaxWidth(), elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp) ) {
) { Text(
Text( text = if (startMonth == endMonth) {
text = if (startMonth == endMonth) { "统计期间:${startMonth.format(DateTimeFormatter.ofPattern("yyyy年MM月"))}"
"统计期间:${startMonth.format(DateTimeFormatter.ofPattern("yyyy年MM月"))}" } else {
} else { "统计期间:${startMonth.format(DateTimeFormatter.ofPattern("yyyy年MM月"))}${endMonth.format(DateTimeFormatter.ofPattern("yyyy年MM月"))}"
"统计期间:${startMonth.format(DateTimeFormatter.ofPattern("yyyy年MM月"))}${endMonth.format(DateTimeFormatter.ofPattern("yyyy年MM月"))}" },
}, style = MaterialTheme.typography.titleMedium,
style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold,
fontWeight = FontWeight.Bold, modifier = Modifier.padding(16.dp),
modifier = Modifier.padding(16.dp), textAlign = TextAlign.Center
textAlign = TextAlign.Center )
)
}
} }
// 支出分类详情 // 支出分类详情
if (expenseByCategory.isNotEmpty()) { if (expenseByCategory.isNotEmpty()) {
item { CategoryDetailCard(
CategoryDetailCard( title = "支出分类明细",
title = "支出分类明细", categoryData = expenseByCategory,
categoryData = expenseByCategory, total = totalExpense,
total = totalExpense, color = MaterialTheme.colorScheme.error,
color = MaterialTheme.colorScheme.error, currencyFormatter = currencyFormatter
currencyFormatter = currencyFormatter )
)
}
} }
// 收入分类详情 // 收入分类详情
if (incomeByCategory.isNotEmpty()) { if (incomeByCategory.isNotEmpty()) {
item { CategoryDetailCard(
CategoryDetailCard( title = "收入分类明细",
title = "收入分类明细", categoryData = incomeByCategory,
categoryData = incomeByCategory, total = totalIncome,
total = totalIncome, color = MaterialTheme.colorScheme.primary,
color = MaterialTheme.colorScheme.primary, currencyFormatter = currencyFormatter
currencyFormatter = currencyFormatter )
)
}
} }
// 分类占比前5名 // 分类占比前5名
if (expenseByCategory.isNotEmpty()) { if (expenseByCategory.isNotEmpty()) {
item { TopCategoriesCard(
TopCategoriesCard( title = "支出TOP5",
title = "支出TOP5", categoryData = expenseByCategory.take(5),
categoryData = expenseByCategory.take(5), total = totalExpense,
total = totalExpense, color = MaterialTheme.colorScheme.error,
color = MaterialTheme.colorScheme.error, currencyFormatter = currencyFormatter
currencyFormatter = currencyFormatter )
)
}
} }
} }
} }