Share
Embed
Jetpack Compose — Next Gen Kotlin UI Toolkit for Android
https://info.jetbrains.com/kotlin-everywhere-bangalore-2019.html
The Android UI toolkit's API surface has remained the same for the past decade. With applications and UI becoming more and more demanding, we need a new programming model to handle this complexity. With Kotlin bringing in DSLs, functional programming, and compiler plugin capabilities - the Android UI Toolkit team is taking a new direction with Jetpack Compose.
This shift in API design also demands a shift in thinking about UI and app architecture. In this talk, we’ll see how Jetpack Compose is radically different from the existing Android UI framework and look at various examples to build reactive Android apps.
Ragunath Jawahar
June 22, 2019
Transcript
127 slides
-
• Unbundled UI Toolkit • React, Litho, Vue.js & Flutter
• Declarative • Composition over inheritance • Kotlin only • “Pre-Alpha” ⛔ -
FRAMEWORKS ARE NOT TOOLS FOR ORGANISING YOUR CODE, THEY ARE
TOOLS FOR ORGANISING YOUR MIND – Rick Hickey -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
// Android framework val textView = TextView(context) println(textView=>class.java) // AB
android.widget.TextView // Jetpack Compose val text = Text(text = "Hello World!") println(text=>class.java) // AB kotlin.Unit No more reference to views -
@Composable fun Text( text: String, style: TextStyle? = null, textAlign:
TextAlign = DefaultTextAlign, // More parameters… ) { // More code… } Composable functions -
@Composable fun Text( text: String, style: TextStyle? = null, textAlign:
TextAlign = DefaultTextAlign, // More parameters… ) { // More code… } Composable functions -
@Composable fun Text( text: String, style: TextStyle? = null, textAlign:
TextAlign = DefaultTextAlign, // More parameters… ) { // More code… } Composable functions -
@Composable fun Text( text: String, style: TextStyle? = null, textAlign:
TextAlign = DefaultTextAlign, // More parameters… ) { // More code… } Composable functions -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Model data class Fruit( val name: String, val price: Double
= 2.0, var quantity: Int = 0 ) { val totalPrice: Double get() = quantity * price } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun Stepper(count: Int, onCountChange: (Int) ^> Unit) { val
onRemoveOne = { onCountChange(count - 1) } val onAddOne = { onCountChange(count + 1) } Row { Button(text = "-", onClick = if (count > 0) onRemoveOne else null) WidthSpacer(8.dp) Container(width = 24.dp) { Text(text = "$count", style = +themeTextStyle { body1 }) } WidthSpacer(8.dp) Button(text = "+", onClick = onAddOne) } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
@Composable fun FruitRow(fruit: Fruit) { Padding(padding = EdgeInsets(left = 16.dp,
right = 16.dp)) { FlexRow { expanded(1.0f) { Text(text = "${fruit.name} ($${fruit.totalPrice})", style = +themeTextStyle { h6 }) } inflexible { Stepper(fruit.quantity, onCountChange = { fruit.quantity = it }) } } } } -
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { FruitApp {
val apple = +memo { Fruit("Apple") } FruitRow(apple) } } } -
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { FruitApp {
val apple = +memo { Fruit("Apple") } FruitRow(apple) } } } -
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { FruitApp {
val apple = +memo { Fruit("Apple") } FruitRow(apple) } } } -
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { FruitApp {
val apple = +memo { Fruit("Apple") } FruitRow(apple) } } } -
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { FruitApp {
val apple = +memo { Fruit("Apple") } FruitRow(apple) } } } -
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { FruitApp {
val apple = +memo { Fruit("Apple") } FruitRow(apple) } } } -
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { FruitApp {
val apple = +memo { Fruit("Apple") } FruitRow(apple) } } } -
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { FruitApp {
val apple = +memo { Fruit("Apple") } FruitRow(apple) } } } -
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { FruitApp {
val apple = +memo { Fruit("Apple") } FruitRow(apple) } } } -
Future • Increased productivity • Higher-level of abstraction • Wider
use of existing of skillset • Collaboration • Design • Product • Other platforms?