Browse Source

Use singleLine=true in the text fields of widgets-gallery (#3054)

pull/3057/head
Alexander Maryanovsky 2 years ago committed by GitHub
parent
commit
b872c3032e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      examples/widgets-gallery/shared/src/commonMain/kotlin/org/jetbrains/compose/demo/widgets/ui/screens/TextInputs.kt

10
examples/widgets-gallery/shared/src/commonMain/kotlin/org/jetbrains/compose/demo/widgets/ui/screens/TextInputs.kt

@ -33,13 +33,15 @@ fun TextInputs() {
value = text,
onValueChange = { newValue -> text = newValue },
modifier = Modifier.padding(8.dp).fillMaxWidth(),
singleLine = true,
label = { Text("label") },
placeholder = { Text("placeholder") }
placeholder = { Text("placeholder") },
)
OutlinedTextField(
value = text,
modifier = Modifier.padding(8.dp).fillMaxWidth(),
singleLine = true,
label = { Text(text = "Password") },
placeholder = { Text(text = "12334444") },
visualTransformation = PasswordVisualTransformation(),
@ -53,6 +55,7 @@ fun TextInputs() {
value = text,
leadingIcon = { Icon(Icons.Default.Email, contentDescription = "Email") },
modifier = Modifier.padding(8.dp).fillMaxWidth(),
singleLine = true,
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text),
label = { Text(text = "Email address") },
placeholder = { Text(text = "Your email") },
@ -65,6 +68,7 @@ fun TextInputs() {
leadingIcon = { Icon(Icons.Default.Email, contentDescription = "Email") },
trailingIcon = { Icon(Icons.Default.Edit, contentDescription = "Edit") },
modifier = Modifier.padding(8.dp).fillMaxWidth(),
singleLine = true,
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text),
label = { Text(text = "Email address") },
placeholder = { Text(text = "Your email") },
@ -74,8 +78,10 @@ fun TextInputs() {
)
var numberText by remember { mutableStateOf(TextFieldValue("")) }
OutlinedTextField(value = numberText,
OutlinedTextField(
value = numberText,
modifier = Modifier.padding(8.dp).fillMaxWidth(),
singleLine = true,
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
label = { Text(text = "Phone number") },
placeholder = { Text(text = "88888888") },

Loading…
Cancel
Save