Last active
April 11, 2022 02:10
-
-
Save hsleedevelop/17761bb74cb5a4778f88f280009a79c2 to your computer and use it in GitHub Desktop.
composable example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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