封装BaseViewModel

This commit is contained in:
Hsy
2025-10-15 15:03:16 +08:00
parent 6e8529caad
commit 05ff710872
24 changed files with 727 additions and 333 deletions

View File

@@ -71,14 +71,14 @@ import taskttl.composeapp.generated.resources.total_tasks
fun StatisticsScreen(
navController: NavHostController,
taskViewModel: TaskViewModel = koinViewModel(),
countdownViewModel: CountdownViewModel = koinViewModel()
countdownViewModel: CountdownViewModel = koinViewModel(),
) {
val taskState by taskViewModel.state.collectAsState()
val countdownState by countdownViewModel.state.collectAsState()
LaunchedEffect(Unit) {
taskViewModel.handleIntent(TaskIntent.LoadTasks)
taskViewModel.processIntent(TaskIntent.LoadTasks)
countdownViewModel.handleIntent(CountdownIntent.LoadCountdowns)
}
@@ -220,7 +220,7 @@ private fun StatisticCard(
value: String,
icon: ImageVector,
color: Color,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
) {
Card(
modifier = modifier,
@@ -264,7 +264,7 @@ private fun CategoryStatisticItem(
category: Category,
totalCount: Int,
completedCount: Int,
typeRes: StringResource
typeRes: StringResource,
) {
if (totalCount == 0) return