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 ProfileContentComposable() { | |
| Column( | |
| modifier = Modifier | |
| .fillMaxHeight() | |
| .padding(start = 8.dp), | |
| verticalArrangement = Arrangement.aligned(Alignment.CenterVertically) | |
| ) { | |
| Text("Catalin Ghita", fontWeight = FontWeight.Bold) | |
| Text( |
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 ProfileContentComposable() { | |
| Column() { | |
| Text("Catalin Ghita") | |
| Text(text = "Active now") | |
| } | |
| } |
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 ProfilePictureComposable() { | |
| Card( | |
| shape = CircleShape, | |
| border = BorderStroke(2.dp, color = Helper.getGreenColor()), | |
| modifier = Modifier.size(48.dp), | |
| elevation = 4.dp | |
| ) { | |
| Image( ... ) | |
| } |
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 ProfilePictureComposable() { | |
| Image( | |
| painter = painterResource(id = R.drawable.profile_pic), | |
| contentScale = ContentScale.Crop, | |
| modifier = Modifier.size(48.dp), | |
| contentDescription = "Profile picture holder" | |
| ) | |
| } |
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 ProfileCardComposable() { | |
| Row(modifier = Modifier | |
| .wrapContentSize() | |
| .clip(RoundedCornerShape(4.dp)) | |
| .background(color = Helper.getWhiteColor()) | |
| .padding(16.dp), | |
| ) { ... } | |
| } |
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 ProfileCardComposable() { | |
| Row() { | |
| ProfilePictureComposable() | |
| ProfileContentComposable() | |
| } | |
| } |
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
| import androidx.compose.ui.graphics.Color | |
| object Helper { | |
| fun getColor(colorString: String) = | |
| Color(android.graphics.Color.parseColor("#$colorString")) | |
| fun getGreenColor() = getColor("9963890a") | |
| fun getWhiteColor() = getColor("FFFFFFFF") | |
| fun getRedColor() = getColor("99ac162c") |
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 MainActivityComposable() { | |
| Surface( | |
| modifier = Modifier.fillMaxSize(), | |
| color = Helper.getGreenColor() | |
| ) | |
| { ProfileCardComposable() } | |
| } |
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
| @Preview(showBackground = true) | |
| @Composable | |
| fun DefaultPreview() { | |
| MyComposeApplication { | |
| Greeting("Android") | |
| } | |
| } |
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 Greeting(name: String) { | |
| Text(text = "Hello $name!") | |
| } |