Slide 93
Slide 93 text
@Composable
fun Stepper(count: Int, onCountChange: (Int) P> 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)
}
}