Align checkbox and text in subtask row

pull/1957/head
Alex Baker 3 years ago
parent 2841af08de
commit 2ee7715c16

@ -131,7 +131,9 @@ fun NewSubtaskRow(
.weight(1f) .weight(1f)
.focusable(enabled = true) .focusable(enabled = true)
.focusRequester(focusRequester) .focusRequester(focusRequester)
.alpha(if (subtask.isCompleted) ContentAlpha.disabled else ContentAlpha.high), .alpha(if (subtask.isCompleted) ContentAlpha.disabled else ContentAlpha.high)
.align(Alignment.Top)
.padding(top = 12.dp),
textStyle = MaterialTheme.typography.body1.copy( textStyle = MaterialTheme.typography.body1.copy(
textDecoration = if (subtask.isCompleted) TextDecoration.LineThrough else TextDecoration.None, textDecoration = if (subtask.isCompleted) TextDecoration.LineThrough else TextDecoration.None,
color = MaterialTheme.colors.onSurface, color = MaterialTheme.colors.onSurface,
@ -147,7 +149,7 @@ fun NewSubtaskRow(
} }
} }
), ),
singleLine = true, singleLine = false,
maxLines = Int.MAX_VALUE, maxLines = Int.MAX_VALUE,
) )
ClearButton { onDelete(subtask) } ClearButton { onDelete(subtask) }
@ -175,13 +177,16 @@ fun ExistingSubtaskRow(
CheckBox( CheckBox(
task = task.task, task = task.task,
onCompleteClick = onCompleteClick, onCompleteClick = onCompleteClick,
desaturate = desaturate desaturate = desaturate,
modifier = Modifier.align(Alignment.Top),
) )
Text( Text(
text = task.title, text = task.title,
modifier = Modifier modifier = Modifier
.weight(1f) .weight(1f)
.alpha(if (task.isCompleted || task.isHidden) ContentAlpha.disabled else ContentAlpha.high), .alpha(if (task.isCompleted || task.isHidden) ContentAlpha.disabled else ContentAlpha.high)
.align(Alignment.Top)
.padding(top = 12.dp),
style = MaterialTheme.typography.body1.copy( style = MaterialTheme.typography.body1.copy(
textDecoration = if (task.isCompleted) TextDecoration.LineThrough else TextDecoration.None textDecoration = if (task.isCompleted) TextDecoration.LineThrough else TextDecoration.None
) )
@ -236,7 +241,7 @@ fun SubtasksPreview() {
}, },
TaskContainer().apply { TaskContainer().apply {
task = Task().apply { task = Task().apply {
title = "Existing subtask 2" title = "Existing subtask 2 with a really long title"
priority = Task.Priority.LOW priority = Task.Priority.LOW
} }
indent = 1 indent = 1
@ -247,7 +252,7 @@ fun SubtasksPreview() {
title = "New subtask 1" title = "New subtask 1"
}, },
Task().apply { Task().apply {
title = "New subtask 2" title = "New subtask 2 with a really long title"
}, },
Task(), Task(),
), ),

Loading…
Cancel
Save