fun createListItem(itemIndex: Int) {
Padding(left = 8.dp, right = 8.dp, top = 8.dp, bottom = 8.dp) {
FlexRow(crossAxisAlignment = CrossAxisAlignment.Center) {
expanded(1.0f) {
Text("Item $itemIndex")
}
inflexible {
Button(
"Button $itemIndex",
style = ContainedButtonStyle(),
onClick = {
Toast.makeText(
this@MainActivity,
"Item name $itemIndex",
Toast.LENGTH_SHORT
).show()
})
}
}
}
}
I try to make Toast in a normal way. but I got the error I tried a lot of multiples source but failed.
Toast
inonClick
handlers in Compose without a problem. If you were getting a compile error, please provide the complete details of the error. If you were getting a runtime error, please edit your question and post the stack trace. – RosalbaSnackbar
overToast
in Compose: kotlinlang.slack.com/archives/CJLTWPH7S/…. – Carew