|
|
@ -14,6 +14,7 @@ import androidx.compose.foundation.lazy.itemsIndexed |
|
|
|
import androidx.compose.material.icons.Icons |
|
|
|
import androidx.compose.material.icons.Icons |
|
|
|
import androidx.compose.material.icons.automirrored.filled.List |
|
|
|
import androidx.compose.material.icons.automirrored.filled.List |
|
|
|
import androidx.compose.material.icons.filled.Add |
|
|
|
import androidx.compose.material.icons.filled.Add |
|
|
|
|
|
|
|
import androidx.compose.material.icons.outlined.Delete |
|
|
|
import androidx.compose.material.icons.outlined.Edit |
|
|
|
import androidx.compose.material.icons.outlined.Edit |
|
|
|
import androidx.compose.material3.FilledTonalButton |
|
|
|
import androidx.compose.material3.FilledTonalButton |
|
|
|
import androidx.compose.material3.Icon |
|
|
|
import androidx.compose.material3.Icon |
|
|
@ -127,6 +128,8 @@ fun ListScreen( |
|
|
|
onCardClick(task.id) |
|
|
|
onCardClick(task.id) |
|
|
|
}, onEditClick = { |
|
|
|
}, onEditClick = { |
|
|
|
onEditClick(task.id) |
|
|
|
onEditClick(task.id) |
|
|
|
|
|
|
|
},onDeleteClick = { |
|
|
|
|
|
|
|
demoViewModel.onDeleteButtonClicked(task) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -150,7 +153,7 @@ fun TaskDetails(task: Task, modifier: Modifier = Modifier) { |
|
|
|
Column(Modifier.padding(16.dp)) { |
|
|
|
Column(Modifier.padding(16.dp)) { |
|
|
|
Text(task.name, style = Typography.headlineMedium) |
|
|
|
Text(task.name, style = Typography.headlineMedium) |
|
|
|
Row { |
|
|
|
Row { |
|
|
|
Text("Details: ${task.details}", style = Typography.headlineMedium) |
|
|
|
Text("Details: ${task.details}", style = Typography.bodyLarge) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -207,7 +210,7 @@ fun AddScreen( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
fun TaskListItem(task: Task, onCardClick: () -> Unit, onEditClick: ()->Unit, modifier: Modifier = Modifier) { |
|
|
|
fun TaskListItem(task: Task, onCardClick: () -> Unit, onEditClick: ()->Unit, onDeleteClick: ()->Unit, modifier: Modifier = Modifier) { |
|
|
|
OutlinedCard( |
|
|
|
OutlinedCard( |
|
|
|
onClick = { onCardClick() }, modifier = modifier |
|
|
|
onClick = { onCardClick() }, modifier = modifier |
|
|
|
.fillMaxWidth() |
|
|
|
.fillMaxWidth() |
|
|
@ -215,8 +218,13 @@ fun TaskListItem(task: Task, onCardClick: () -> Unit, onEditClick: ()->Unit, mod |
|
|
|
) { |
|
|
|
) { |
|
|
|
Row(Modifier.padding(16.dp), verticalAlignment = Alignment.CenterVertically) { |
|
|
|
Row(Modifier.padding(16.dp), verticalAlignment = Alignment.CenterVertically) { |
|
|
|
Text(task.name, style = Typography.headlineMedium) |
|
|
|
Text(task.name, style = Typography.headlineMedium) |
|
|
|
|
|
|
|
Row { |
|
|
|
IconButton(onEditClick) { |
|
|
|
IconButton(onEditClick) { |
|
|
|
Icon(Icons.Outlined.Edit, "Edit contact") |
|
|
|
Icon(Icons.Outlined.Edit, "Edit Task") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
IconButton(onDeleteClick) { |
|
|
|
|
|
|
|
Icon(Icons.Outlined.Delete, "Delete Task") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -225,5 +233,5 @@ fun TaskListItem(task: Task, onCardClick: () -> Unit, onEditClick: ()->Unit, mod |
|
|
|
@Preview |
|
|
|
@Preview |
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
fun PreviewTaskListItem(){ |
|
|
|
fun PreviewTaskListItem(){ |
|
|
|
TaskListItem(Task(0, "Buy Milk", "buy milk"), {}, {}) |
|
|
|
TaskListItem(Task(0, "Buy Milk", "buy milk"), {}, {}, {}) |
|
|
|
} |
|
|
|
} |