Skip to content

Instantly share code, notes, and snippets.

Avatar

Elif Boncuk ElifBon

View GitHub Profile
View compose-adapterlist
@Composable
fun SpeakerList(speakers: List<SpeakerInfo>){
AdapterList(data = speakers) {
SpeakerInformation(speaker = it)
}
}
View compose-image-dev09
@Composable
fun SpeakerImage(image: ImageAsset?) {
image?.let {
val imageModifier = Modifier
.preferredHeightIn(maxHeight = 180.dp)
.fillMaxWidth()
.clip(shape = RoundedCornerShape(4.dp))
Image(image, modifier = imageModifier, contentScale = ContentScale.Crop)
View Compose scrolling list
@Composable
fun SpeakerList(speakers: List<SpeakerInfo>){
ScrollingList(speakers) { speaker ->
SpeakerInformation(speaker)
}
}
View Compose theming
@Composable
fun Title(title: String) {
Text(title,
style = themeTypography.h6)
}
View Compose Flexible
@Composable
fun StateSampleScreen(
names: List<String> = listOf("Android", "there"),
counterState: CounterState = CounterState()
) {
Column(modifier = ExpandedHeight) {
Column(modifier = Flexible(1f)) {
for (name in names) {
Greeting(name = name)
Divider(color = Color.Black)
View Compose Model
@Model
class CounterState(var count: Int = 0)
@Composable
fun Counter(state: CounterState) {
Button(
text = "I've been clicked ${state.count} times",
onClick = {
state.count++
},
View gist:812efdefcf96d80c58d136a07edde88c
@Composable
fun SpeakerInformation(speaker: SpeakerInfo) {
Column(
modifier = Spacing(16.dp)
) {
Container(modifier = Height(180.dp) wraps Expanded) {
Clip(RoundedCornerShape(5.dp)) {
DrawImage(image = speaker.image)
}
View Compose adding image
@Composable
fun SpeakerInformation(speaker: SpeakerInfo) {
Column(
modifier = Spacing(16.dp)
) {
DrawImage(image = speaker.image)
Text(speaker.name)
Text(speaker.title)
Text(speaker.sessionTitle)
View Compose container functions
@Composable
fun IWDDemoApp(children: @Composable() () -> Unit) {
MaterialTheme(colors = lightThemeColors){
children()
}
}
View Compose Column
@Composable
fun SpeakerInformation(speaker: SpeakerInfo) {
Column(
modifier = Spacing(16.dp)
) {
Text(speaker.name)
Text(speaker.title)
Text(speaker.sessionTitle)
}
You can’t perform that action at this time.