Skip to content

Instantly share code, notes, and snippets.

@GerardPaligot
Last active March 19, 2022 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GerardPaligot/d877f25ef99e44167b37c899392d71fb to your computer and use it in GitHub Desktop.
Save GerardPaligot/d877f25ef99e44167b37c899392d71fb to your computer and use it in GitHub Desktop.
@Composable
fun ProfileInput(
profile: UserProfileUi,
modifier: Modifier = Modifier
) {
Scaffold(modifier = modifier) {
// Require to go at the next input from the keyboard.
val focusManager = LocalFocusManager.current
LazyColumn {
if (profile.qrCode != null) {
item {
Image(bitmap = profile.qrCode!!.asImageBitmap())
}
}
item {
TextField(
value = profile.email,
label = { Text("Your email address*") },
keyboardOptions = KeyboardOptions(
imeAction = ImeAction.Next,
keyboardType = KeyboardType.Email
)
)
}
item {
TextField(
value = profile.firstName,
label = { Text("Your first name*") },
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next)
)
}
item {
TextField(
value = profile.lastName,
label = { Text("Your last name*") },
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next)
)
}
item {
TextField(
value = profile.company,
label = { Text("Your company") },
keyboardActions = KeyboardActions(onDone = {
focusManager.clearFocus()
}),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done)
)
}
item {
Button(
onClick = {
focusManager.clearFocus()
}
) {
Text("Generate your QR code")
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment