Exploring Jetpack Compose

@Composable
fun MyView() {
Text("Hello guys")
}
@Composable
fun MyView() {
Column {
Text("Hello Guys", style = typography.h4)
Text("This is my fist composable function", style = typography.h5)
}
}
@Composable
fun MyView() {
Row {
Text("Name:")
Text("John")
}
}
Button(onClick = {
//do some action here

}) {
Text("Click me")
}
TopAppBar(
backgroundColor = MaterialTheme.colors.primaryVariant,
contentColor = Color.White,
title = {
Text(text = "Tutorial")
},
navigationIcon = {
IconButton(onClick = { finish() }) {
Icon(Icons.Filled.ArrowBack)
}
}
,
actions = {
IconButton(onClick = {}) {
Icon(Icons.Filled.Favorite)
}
IconButton(onClick = {}) {
Icon(Icons.Filled.AccountBox)
}
}
,
elevation = 4.dp
)
Card(
elevation = 4.dp,
border = BorderStroke(1.dp, Color.LightGray),
modifier = Modifier.padding(16.dp).fillMaxWidth()

) {}
@Composable
private fun CountryListView() {
val countries = countryList()
LazyColumnFor(items = countries) { country ->
Card(
elevation = 4.dp,
border = BorderStroke(1.dp, Color.LightGray),
modifier = Modifier.padding(
start = 16.dp,
end = 16.dp,
top = 8.dp,
bottom = 8.dp,
).fillMaxWidth(),
) {
Column(modifier = Modifier.padding(16.dp)) {
Text(country.name, style = typography.h4)
Text(country.capital, style = typography.body1)
}
}
}
}
LazyColumnForIndexed(items = countries) { index, country ->  

}
@Composable
private fun CountryListHorizontal(){
val countries = countryList()
LazyRowFor(items = countries) { country ->
Card(
elevation = 4.dp,
border = BorderStroke(1.dp, Color.LightGray),
modifier = Modifier.padding(
start = 8.dp,
end = 8.dp,
top = 16.dp,
bottom = 16.dp,
).fillMaxWidth(),
) {
Column(modifier = Modifier.padding(16.dp)) {
Text(country.name, style = typography.h4)
Text(country.capital, style = typography.body1)
}
}
}
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chetan Bhalerao

Chetan Bhalerao

67 Followers

Product engineer @Gojek , Android developer, Backend developer. Interested in exploring new technologies. https://twitter.com/csbhalerao