Проработано диалоговое окно сценария

Этот коммит содержится в:
Глеб Иваницкий 2024-08-24 16:03:57 +03:00
родитель 391a78c948
Коммит aecb9a984b

Просмотреть файл

@ -22,6 +22,7 @@ import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text import androidx.compose.material3.Text
@ -55,6 +56,7 @@ import cit_is_bot.composeapp.generated.resources.outline_adjust_24
import cit_is_bot.composeapp.generated.resources.outline_time_auto_24 import cit_is_bot.composeapp.generated.resources.outline_time_auto_24
import org.jetbrains.compose.resources.DrawableResource import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.painterResource
import ru.csasq.cit_is_bot.ui.components.TextCheckbox
import ru.csasq.cit_is_bot.ui.screens.Scenario import ru.csasq.cit_is_bot.ui.screens.Scenario
enum class MessageType( enum class MessageType(
@ -367,6 +369,24 @@ fun ScenarioDialog(
modifier = Modifier modifier = Modifier
.height(8.dp), .height(8.dp),
) )
val disableNotificationCheckboxState = remember {
mutableStateOf(false)
}
TextCheckbox(
text = "Не отправлять уведомление",
checkboxState = disableNotificationCheckboxState,
)
val deleteAfterEndCheckboxState = remember {
mutableStateOf(false)
}
TextCheckbox(
text = "Удалить после окончания",
checkboxState = deleteAfterEndCheckboxState,
)
Spacer(
modifier = Modifier
.height(8.dp),
)
ExposedDropdownMenuBox( ExposedDropdownMenuBox(
expanded = dropdownMenuState.value, expanded = dropdownMenuState.value,
onExpandedChange = { value -> onExpandedChange = { value ->
@ -431,18 +451,23 @@ fun ScenarioDialog(
} }
} }
} }
Spacer(
modifier = Modifier when {
.height(16.dp), messageTypeState.value != MessageType.DICE -> {
) Spacer(
Text( modifier = Modifier
text = messageTypeState.value.displayName, .height(16.dp),
style = MaterialTheme.typography.titleMedium, )
) Text(
Spacer( text = messageTypeState.value.displayName,
modifier = Modifier style = MaterialTheme.typography.titleMedium,
.height(8.dp), )
) Spacer(
modifier = Modifier
.height(8.dp),
)
}
}
when (messageTypeState.value) { when (messageTypeState.value) {
MessageType.TEXT -> { MessageType.TEXT -> {
@ -508,10 +533,7 @@ fun ScenarioDialog(
optionState.value = value optionState.value = value
}, },
modifier = Modifier modifier = Modifier
.weight( .weight(1f),
weight = 1f,
fill = true,
),
label = {}, label = {},
isError = false, isError = false,
singleLine = true, singleLine = true,
@ -529,9 +551,88 @@ fun ScenarioDialog(
) )
} }
} }
Spacer(
modifier = Modifier
.height(16.dp),
)
Text(
text = "Настройки",
style = MaterialTheme.typography.titleMedium,
)
Spacer(
modifier = Modifier
.height(8.dp),
)
val anonymousPollCheckboxState = remember {
mutableStateOf(false)
}
TextCheckbox(
text = "Анонимное голосование",
checkboxState = anonymousPollCheckboxState,
)
val multiselectPollCheckboxState = remember {
mutableStateOf(false)
}
TextCheckbox(
text = "Выбор нескольких ответов",
checkboxState = multiselectPollCheckboxState,
)
}
MessageType.MEDIA -> {
OutlinedButton(
onClick = {},
) {
Icon(
painter = painterResource(Res.drawable.baseline_attach_file_24),
contentDescription = null,
)
Text(
text = "Прикрепить файл",
)
}
}
MessageType.CONTACT -> {
val contactPhoneNumberState = remember {
mutableStateOf("")
}
OutlinedTextField(
value = contactPhoneNumberState.value,
onValueChange = { value ->
contactPhoneNumberState.value = value
},
modifier = Modifier
.fillMaxWidth(),
label = {
Text(
text = "Номер телефона",
)
},
isError = false,
singleLine = true,
)
Spacer(
modifier = Modifier
.height(8.dp),
)
val contactNameState = remember {
mutableStateOf("")
}
OutlinedTextField(
value = contactNameState.value,
onValueChange = { value ->
contactNameState.value = value
},
modifier = Modifier
.fillMaxWidth(),
label = {
Text(
text = "Имя",
)
},
isError = false,
singleLine = true,
)
} }
MessageType.MEDIA -> {}
MessageType.CONTACT -> {}
MessageType.DICE -> {} MessageType.DICE -> {}
} }
} }