Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FilipeLipan/44256b5085c85edd3d1f8f871090a43d to your computer and use it in GitHub Desktop.
Save FilipeLipan/44256b5085c85edd3d1f8f871090a43d to your computer and use it in GitHub Desktop.
package com.github.filipelipan.composebuss
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.github.filipelipan.composebuss.ui.theme.ComposeBussTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
ComposeBussTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
Box(modifier = Modifier.fillMaxSize().padding(30.dp)){
Column(modifier = Modifier
.height(100.dp)
.background(Color.DarkGray)
.fillMaxWidth()) {
Row(modifier = Modifier
.fillMaxWidth()
.height(50.dp)) {
val list = listOf(1,2,3,4,5)
list.forEach {
Box(modifier = Modifier
.width(40.dp)
.height(40.dp)
.background(
Color.Blue
))
Spacer(modifier = Modifier.width(5.dp))
}
}
Row(modifier = Modifier
.fillMaxWidth()
.height(50.dp)) {
val list = listOf(1,2,3,4,5)
list.forEach {
Box(modifier = Modifier
.width(40.dp)
.height(40.dp)
.background(
Color.Blue
))
Spacer(modifier = Modifier.width(5.dp))
}
}
}
}
}
}
}
}
}
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
ComposeBussTheme {
Greeting("Android")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment