You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
3 years ago
|
package example.todoapp.lite.common
|
||
|
|
||
3 years ago
|
import androidx.compose.foundation.background
|
||
|
import androidx.compose.foundation.layout.*
|
||
3 years ago
|
import androidx.compose.material.Checkbox
|
||
|
import androidx.compose.material.Text
|
||
|
import androidx.compose.material.TextField
|
||
|
import androidx.compose.runtime.Composable
|
||
|
import androidx.compose.ui.Alignment
|
||
|
import androidx.compose.ui.Modifier
|
||
3 years ago
|
import androidx.compose.ui.graphics.Color
|
||
3 years ago
|
import androidx.compose.ui.unit.dp
|
||
|
|
||
|
@Composable
|
||
|
internal fun EditDialog(
|
||
|
item: TodoItem,
|
||
|
onCloseClicked: () -> Unit,
|
||
|
onTextChanged: (String) -> Unit,
|
||
|
onDoneChanged: (Boolean) -> Unit,
|
||
|
) {
|
||
|
Dialog(
|
||
|
title = "Edit todo",
|
||
|
onCloseRequest = onCloseClicked,
|
||
|
) {
|
||
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||
|
TextField(
|
||
|
value = item.text,
|
||
|
modifier = Modifier.weight(1F).fillMaxWidth().sizeIn(minHeight = 192.dp),
|
||
|
label = { Text("Todo text") },
|
||
|
onValueChange = onTextChanged,
|
||
|
)
|
||
|
|
||
|
Spacer(modifier = Modifier.height(8.dp))
|
||
|
|
||
|
Row {
|
||
3 years ago
|
Text(text = "Completed", Modifier.padding(15.dp))
|
||
3 years ago
|
|
||
|
Checkbox(
|
||
|
checked = item.isDone,
|
||
|
onCheckedChange = onDoneChanged,
|
||
|
)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|