Skip to content

Instantly share code, notes, and snippets.

@ebubekirsezer
Created July 13, 2020 12:30
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 ebubekirsezer/7ce239709c417997729a0eddc29f2fb0 to your computer and use it in GitHub Desktop.
Save ebubekirsezer/7ce239709c417997729a0eddc29f2fb0 to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyApplicationTheme {
profileDesign()
}
}
}
}
@Composable
fun profileDesign(){
val image = imageResource(id = R.drawable.ronaldo)
val imageList = listOf<Int>(R.drawable.post1,R.drawable.post2,R.drawable.post3,R.drawable.post4)
MaterialTheme {
Column(
modifier = Modifier.padding(16.dp)
) {
val imageModifier = Modifier
.heightIn(maxHeight = 120.dp)
.widthIn(maxWidth = 120.dp)
.clip(shape = CircleShape).gravity(align = Alignment.CenterHorizontally)
val postModifier = Modifier
.preferredHeightIn(maxHeight = 180.dp)
.fillMaxWidth()
.clip(shape = RoundedCornerShape(4.dp))
Image(image, modifier = imageModifier,
contentScale = ContentScale.Crop)
Spacer(Modifier.preferredHeight(16.dp))
Text("Cristiano Ronaldo", style = typography.h4)
Text("Juventus", style = typography.body1)
Text("Position: Striker", style = typography.body2)
VerticalScroller {
MaterialTheme {
Column (
modifier = Modifier.padding(15.dp)
){
//Image(asset = imageResource(id = imageList[0]),modifier = postModifier,contentScale = ContentScale.Crop)
imageList.forEachIndexed { index, i ->
Spacer(Modifier.preferredHeight(15.dp))
Row {
Image(asset = imageResource(id = imageList[index]),modifier = postModifier,contentScale = ContentScale.Crop)
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment