Created
March 16, 2021 18:52
-
-
Save pauloaapereira/4c7147dc70f976516e53e8f5fa11ad1e to your computer and use it in GitHub Desktop.
Android Dev Challenge - Week 3 - Bloom - A Full Development Overview - 4
This file contains 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
@ExperimentalComposeUiApi | |
@Composable | |
fun Login(onLoginClick: () -> Unit = {}) { | |
Surface(color = MaterialTheme.colors.background) { | |
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { | |
Column( | |
horizontalAlignment = Alignment.CenterHorizontally, | |
verticalArrangement = Arrangement.Center | |
) { | |
Text( | |
text = "Log in with email", | |
color = MaterialTheme.colors.onBackground, | |
style = MaterialTheme.typography.h1 | |
) | |
BloomTextInput( | |
modifier = Modifier.padding(top = 16.dp), | |
label = "Email address", | |
keyboardType = KeyboardType.Text | |
) | |
BloomTextInput( | |
modifier = Modifier.padding(top = 8.dp), | |
label = "Password (8+ characters", | |
keyboardType = KeyboardType.Password | |
) | |
Text( | |
text = getTermsAndPrivacyPolicy(), | |
color = MaterialTheme.colors.onBackground, | |
style = MaterialTheme.typography.body2, | |
textAlign = TextAlign.Center, | |
modifier = Modifier.paddingFromBaseline(top = 24.dp) | |
) | |
BloomLoginButton( | |
modifier = Modifier.padding(top = 16.dp), | |
text = "Log in", | |
onClick = onLoginClick | |
) | |
} | |
} | |
} | |
} | |
private fun getTermsAndPrivacyPolicy() = | |
buildAnnotatedString { | |
append("By clicking below, you agree to our ") | |
withStyle(style = SpanStyle(textDecoration = TextDecoration.Underline)) { | |
append("Terms of Use") | |
} | |
append(" and consent to our ") | |
withStyle(style = SpanStyle(textDecoration = TextDecoration.Underline)) { | |
append("Privacy Policy") | |
} | |
append(".") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment