Flammer99
04/01/2024, 3:27 PM@Composable
fun list(
item: GymContents,
onEditClick: @Composable () -> Unit,
onDeleteClick: () -> Unit,
viewModel: GymViewModel
) {
val isEditing by viewModel.isEditing.collectAsState()
Row(
modifier = Modifier
.padding(8.dp)
.fillMaxWidth()
.border(
border = BorderStroke(2.dp, Color.Black),
shape = RoundedCornerShape(20)
)
) {
Text(text = item.name, modifier = Modifier.padding(8.dp))
Text(
text = "Sets: ${item.sets}",
modifier = Modifier.padding(8.dp)
)
Text(text = "Reps: ${item.reps}")
Text(text = "Lift: ${item.lift}")
Row(modifier = Modifier.padding(8.dp)) {
IconButton(onClick = onEditClick) {
Icon(imageVector = Icons.Default.Edit, contentDescription = null)
}
IconButton(onClick = onDeleteClick) {
Icon(imageVector = Icons.Default.Delete, contentDescription = null)
}
}
}}
Type inference failed. Expected type mismatch: inferred type is @Composable () -> Unit but () -> Unit was expectedChrimaeon
04/01/2024, 3:35 PMonEditClick
as a Composable function. But onClick
expects a “normal” function.Flammer99
04/01/2024, 3:41 PMFlammer99
04/01/2024, 3:41 PMChrimaeon
04/01/2024, 3:41 PMChrimaeon
04/01/2024, 3:42 PMChrimaeon
04/01/2024, 3:43 PMFlammer99
04/01/2024, 3:43 PMJulien Raad
04/01/2024, 4:30 PMFlammer99
04/01/2024, 4:37 PMChrimaeon
04/01/2024, 5:53 PM