Browse Source

Small cleanup in widgets gallery

pull/1312/head
Nikolay Igotti 3 years ago
parent
commit
799f9d82c5
  1. 26
      examples/widgets-gallery/common/src/commonMain/kotlin/org/jetbrains/compose/demo/widgets/ui/screens/Toggles.kt

26
examples/widgets-gallery/common/src/commonMain/kotlin/org/jetbrains/compose/demo/widgets/ui/screens/Toggles.kt

@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
@ -30,29 +31,14 @@ fun Toggles() {
AlignedColumn {
var selected by remember { mutableStateOf("Kotlin") }
Row {
RadioButton(selected = selected == "Kotlin", onClick = { selected = "Kotlin" })
Text(
text = "Kotlin",
modifier = Modifier.clickable(onClick = { selected = "Kotlin" }).padding(start = 4.dp)
)
}
//Spacer(modifier = Modifier.size(4.dp))
Row {
RadioButton(selected = selected == "Java", onClick = { selected = "Java" })
for (lang in arrayOf("Kotlin", "Java", "Swift")) {
Row(verticalAlignment = Alignment.CenterVertically) {
RadioButton(selected = selected == lang, onClick = { selected = lang })
Text(
text = "Java",
modifier = Modifier.clickable(onClick = { selected = "Java" }).padding(start = 4.dp)
text = lang,
modifier = Modifier.clickable(onClick = { selected = lang }).padding(start = 4.dp)
)
}
//Spacer(modifier = Modifier.size(4.dp))
Row {
RadioButton(selected = selected == "Swift", onClick = { selected = "Swift" })
Text(
text = "Swift",
modifier = Modifier.clickable(onClick = { selected = "Swift" }).padding(start = 4.dp)
)
}
}

Loading…
Cancel
Save