Improve ListItem logical item grouping
This commit is contained in:
parent
47f030cffe
commit
55f51a01a0
1 changed files with 36 additions and 35 deletions
|
|
@ -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,30 +111,30 @@ fun CreatePollView(
|
||||||
.fillMaxSize(),
|
.fillMaxSize(),
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
Text(
|
Column {
|
||||||
text = stringResource(id = R.string.screen_create_poll_question_desc),
|
Text(
|
||||||
modifier = Modifier.padding(start = 32.dp),
|
text = stringResource(id = R.string.screen_create_poll_question_desc),
|
||||||
style = ElementTheme.typography.fontBodyMdRegular,
|
modifier = Modifier.padding(start = 32.dp),
|
||||||
)
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
}
|
)
|
||||||
item {
|
ListItem(
|
||||||
ListItem(
|
headlineContent = {
|
||||||
headlineContent = {
|
OutlinedTextField(
|
||||||
OutlinedTextField(
|
value = state.question,
|
||||||
value = state.question,
|
onValueChange = {
|
||||||
onValueChange = {
|
state.eventSink(CreatePollEvents.SetQuestion(it))
|
||||||
state.eventSink(CreatePollEvents.SetQuestion(it))
|
},
|
||||||
},
|
modifier = Modifier
|
||||||
modifier = Modifier
|
.focusRequester(questionFocusRequester)
|
||||||
.focusRequester(questionFocusRequester)
|
.fillMaxWidth(),
|
||||||
.fillMaxWidth(),
|
placeholder = {
|
||||||
placeholder = {
|
Text(text = stringResource(id = R.string.screen_create_poll_question_hint))
|
||||||
Text(text = stringResource(id = R.string.screen_create_poll_question_hint))
|
},
|
||||||
},
|
keyboardOptions = keyboardOptions,
|
||||||
keyboardOptions = keyboardOptions,
|
)
|
||||||
)
|
}
|
||||||
}
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
itemsIndexed(state.answers) { index, answer ->
|
itemsIndexed(state.answers) { index, answer ->
|
||||||
ListItem(
|
ListItem(
|
||||||
|
|
@ -175,17 +176,17 @@ fun CreatePollView(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
HorizontalDivider()
|
Column {
|
||||||
}
|
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)) },
|
trailingContent = ListItemContent.Switch(
|
||||||
trailingContent = ListItemContent.Switch(
|
checked = state.pollKind == PollKind.Undisclosed,
|
||||||
checked = state.pollKind == PollKind.Undisclosed,
|
onChange = { state.eventSink(CreatePollEvents.SetPollKind(if (it) PollKind.Undisclosed else PollKind.Disclosed)) },
|
||||||
onChange = { state.eventSink(CreatePollEvents.SetPollKind(if (it) PollKind.Undisclosed else PollKind.Disclosed)) },
|
),
|
||||||
),
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue