Improve ListItem logical item grouping

This commit is contained in:
Marco Romano 2023-09-13 10:25:30 +02:00
parent 47f030cffe
commit 55f51a01a0

View file

@ -18,6 +18,7 @@ package io.element.android.features.poll.impl.create
import androidx.activity.compose.BackHandler import androidx.activity.compose.BackHandler
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
@ -110,13 +111,12 @@ fun CreatePollView(
.fillMaxSize(), .fillMaxSize(),
) { ) {
item { item {
Column {
Text( Text(
text = stringResource(id = R.string.screen_create_poll_question_desc), text = stringResource(id = R.string.screen_create_poll_question_desc),
modifier = Modifier.padding(start = 32.dp), modifier = Modifier.padding(start = 32.dp),
style = ElementTheme.typography.fontBodyMdRegular, style = ElementTheme.typography.fontBodyMdRegular,
) )
}
item {
ListItem( ListItem(
headlineContent = { headlineContent = {
OutlinedTextField( OutlinedTextField(
@ -135,6 +135,7 @@ fun CreatePollView(
} }
) )
} }
}
itemsIndexed(state.answers) { index, answer -> itemsIndexed(state.answers) { index, answer ->
ListItem( ListItem(
headlineContent = { headlineContent = {
@ -175,9 +176,8 @@ fun CreatePollView(
} }
} }
item { item {
Column {
HorizontalDivider() HorizontalDivider()
}
item {
ListItem( ListItem(
headlineContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_headline)) }, headlineContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_headline)) },
supportingContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_desc)) }, supportingContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_desc)) },
@ -190,6 +190,7 @@ fun CreatePollView(
} }
} }
} }
}
@DayNightPreviews @DayNightPreviews
@Composable @Composable