Skip to content

Instantly share code, notes, and snippets.

@nglauber
Created July 15, 2020 13:02
Show Gist options
  • Save nglauber/a4db90c27a4e3f81b39d130a6c363c73 to your computer and use it in GitHub Desktop.
Save nglauber/a4db90c27a4e3f81b39d130a6c363c73 to your computer and use it in GitHub Desktop.
package com.example.demo_gdg_curitiba
import androidx.compose.Composable
import androidx.ui.core.Modifier
import androidx.ui.core.drawShadow
import androidx.ui.foundation.Text
import androidx.ui.foundation.clickable
import androidx.ui.foundation.drawBackground
import androidx.ui.foundation.drawBorder
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
import androidx.ui.layout.fillMaxWidth
import androidx.ui.layout.padding
import androidx.ui.material.MaterialTheme
import androidx.ui.text.TextStyle
import androidx.ui.text.font.FontWeight
import androidx.ui.text.style.TextAlign
import androidx.ui.tooling.preview.Preview
import androidx.ui.unit.dp
/**
* My Component
*
* @sample com.example.demo_gdg_curitiba.PreviewDemo2()
*/
@Composable
fun Demo2() {
val shape = CircleShape
Text(
text = "Text 1",
style = TextStyle(
color = Color.White,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center),
modifier = Modifier.fillMaxWidth()
.padding(16.dp)
.drawShadow(2.dp, shape)
.drawBorder(2.dp, MaterialTheme.colors.secondary, shape)
.padding(1.dp) //FIXME
.drawBackground(MaterialTheme.colors.primary, shape)
.clickable(onClick = {
// Click event
})
.padding(16.dp)
)
}
@Preview(showBackground = true)
@Composable
fun PreviewDemo2() {
MaterialTheme {
Demo2()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment