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