Created
February 7, 2022 07:19
-
-
Save merttoptas/7713986e1cecf01aa7308566ad424562 to your computer and use it in GitHub Desktop.
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
@Composable | |
fun WelcomeScreen() { | |
Surface(color = MaterialTheme.colors.primary, modifier = Modifier.fillMaxSize()) { | |
Box( | |
modifier = Modifier | |
.fillMaxWidth() | |
) { | |
WelcomeBackground(modifier = Modifier) | |
} | |
Column( | |
modifier = Modifier.fillMaxSize(), | |
horizontalAlignment = Alignment.CenterHorizontally | |
) { | |
Box( | |
modifier = Modifier | |
.fillMaxWidth() | |
.weight(1f) | |
) { | |
WelcomeLeafImageBackground( | |
modifier = Modifier | |
.padding(top = 72.dp) | |
.offset(x = 88.dp) | |
) | |
} | |
Box( | |
modifier = Modifier | |
.fillMaxWidth() | |
.weight(1f), | |
contentAlignment = Alignment.Center | |
) { | |
Column(horizontalAlignment = Alignment.CenterHorizontally) { | |
BloomLogo() | |
BloomText(modifier = Modifier) | |
CreateAccountButton(modifier = Modifier) | |
LogInTextButton(modifier = Modifier) | |
} | |
} | |
} | |
} | |
} | |
@Composable | |
fun WelcomeBackground(modifier: Modifier) { | |
Image( | |
modifier = modifier.fillMaxWidth(), | |
painter = painterResource(id = R.drawable.ic_light_welcome_bg), | |
contentDescription = null, | |
contentScale = ContentScale.FillWidth, | |
) | |
} | |
@Composable | |
fun WelcomeLeafImageBackground(modifier: Modifier) { | |
Image( | |
modifier = modifier | |
.fillMaxWidth(), | |
painter = painterResource(id = R.drawable.ic_light_welcome_illos), | |
contentDescription = null, | |
contentScale = ContentScale.Inside, | |
) | |
} | |
@Composable | |
fun BloomLogo() { | |
Image( | |
painter = painterResource(id = R.drawable.ic_light_logo), | |
contentDescription = null, | |
contentScale = ContentScale.Fit, | |
) | |
} | |
@Composable | |
fun BloomText(modifier: Modifier) { | |
Text( | |
modifier = modifier.paddingFromBaseline(top = 32.dp, bottom = 40.dp), | |
text = "Beautiful home garden solutions", | |
color = MaterialTheme.colors.onBackground, | |
style = MaterialTheme.typography.subtitle1 | |
) | |
} | |
@Composable | |
fun LogInTextButton(modifier: Modifier) { | |
TextButton( | |
onClick = {}, | |
modifier = modifier | |
.padding(horizontal = 32.dp) | |
.defaultMinSize(minHeight = 50.dp), | |
content = { | |
Text(text = "Log in", color = MaterialTheme.colors.secondary) | |
} | |
) | |
} | |
@Composable | |
fun CreateAccountButton(modifier: Modifier) { | |
Button( | |
onClick = { /*TODO*/ }, | |
shape = RoundedCornerShape(50), | |
modifier = modifier | |
.fillMaxWidth() | |
.padding(horizontal = 16.dp), | |
colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colors.onPrimary), | |
) { | |
Text(text = "Create Account", color = Color.White) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment