Browse Source

Fixed layout in Toggles.

pull/298/head
Roman Sedaikin 4 years ago
parent
commit
d109e8d8cf
  1. 23
      examples/intelliJPlugin/src/main/kotlin/com/jetbrains/compose/widgets/Toggles.kt

23
examples/intelliJPlugin/src/main/kotlin/com/jetbrains/compose/widgets/Toggles.kt

@ -1,9 +1,11 @@
package com.jetbrains.compose.widgets package com.jetbrains.compose.widgets
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.Checkbox import androidx.compose.material.Checkbox
@ -47,22 +49,36 @@ fun Toggles() {
modifier = Modifier.padding(16.dp) modifier = Modifier.padding(16.dp)
) { ) {
var selected by remember { mutableStateOf("Kotlin") } var selected by remember { mutableStateOf("Kotlin") }
Row(verticalAlignment = Alignment.CenterVertically) { Row {
RadioButton(selected = selected == "Kotlin", onClick = { selected = "Kotlin" }) RadioButton(selected = selected == "Kotlin", onClick = { selected = "Kotlin" })
Box(
modifier = Modifier.height(30.dp),
contentAlignment = Alignment.CenterStart
) {
Text( Text(
text = "Kotlin", text = "Kotlin",
modifier = Modifier.clickable(onClick = { selected = "Kotlin" }).padding(start = 4.dp) modifier = Modifier.clickable(onClick = { selected = "Kotlin" }).padding(start = 4.dp)
) )
} }
Row(verticalAlignment = Alignment.CenterVertically) { }
Row {
RadioButton(selected = selected == "Java", onClick = { selected = "Java" }) RadioButton(selected = selected == "Java", onClick = { selected = "Java" })
Box(
modifier = Modifier.height(30.dp),
contentAlignment = Alignment.CenterStart
) {
Text( Text(
text = "Java", text = "Java",
modifier = Modifier.clickable(onClick = { selected = "Java" }).padding(start = 4.dp) modifier = Modifier.clickable(onClick = { selected = "Java" }).padding(start = 4.dp)
) )
} }
Row(verticalAlignment = Alignment.CenterVertically) { }
Row {
RadioButton(selected = selected == "Swift", onClick = { selected = "Swift" }) RadioButton(selected = selected == "Swift", onClick = { selected = "Swift" })
Box(
modifier = Modifier.height(30.dp),
contentAlignment = Alignment.CenterStart
) {
Text( Text(
text = "Swift", text = "Swift",
modifier = Modifier.clickable(onClick = { selected = "Swift" }).padding(start = 4.dp) modifier = Modifier.clickable(onClick = { selected = "Swift" }).padding(start = 4.dp)
@ -70,6 +86,7 @@ fun Toggles() {
} }
} }
} }
}
var sliderState by remember { mutableStateOf(0f) } var sliderState by remember { mutableStateOf(0f) }
Slider(value = sliderState, modifier = Modifier.fillMaxWidth().padding(8.dp), Slider(value = sliderState, modifier = Modifier.fillMaxWidth().padding(8.dp),

Loading…
Cancel
Save