Разработан новый компонент
Этот коммит содержится в:
родитель
62001b1e85
Коммит
391a78c948
@ -0,0 +1,44 @@
|
|||||||
|
package ru.csasq.cit_is_bot.ui.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
|
import androidx.compose.material3.Checkbox
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.MutableState
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TextCheckbox(
|
||||||
|
text: String,
|
||||||
|
checkboxState: MutableState<Boolean>,
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
|
val interactionSource = MutableInteractionSource()
|
||||||
|
Checkbox(
|
||||||
|
checked = checkboxState.value,
|
||||||
|
onCheckedChange = { value ->
|
||||||
|
checkboxState.value = value
|
||||||
|
},
|
||||||
|
interactionSource = interactionSource,
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = text,
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.fillMaxHeight()
|
||||||
|
.clickable(
|
||||||
|
interactionSource = interactionSource,
|
||||||
|
indication = null,
|
||||||
|
onClick = {
|
||||||
|
checkboxState.value = !checkboxState.value
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче
Block a user