Skip to content

Instantly share code, notes, and snippets.

@Ahmed-Sellami
Created August 24, 2021 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ahmed-Sellami/c07811273bb7369859d0835eb665dab2 to your computer and use it in GitHub Desktop.
Save Ahmed-Sellami/c07811273bb7369859d0835eb665dab2 to your computer and use it in GitHub Desktop.
/* ... */
var isFired by remember { mutableStateOf(false) }
val shoesArticles = remember { mutableStateListOf<ShoesArticle>() }
var addedArticle by remember { mutableStateOf(ShoesArticle()) }
var id by remember { mutableStateOf(0) }
Scaffold(
topBar = {
Box {
/* ... */
TopAppBar(
title = {
Text(text = "List Animations In Compose")
},
actions = {
IconButton(onClick = {
particleColor = colorsArray.random()
addedArticle =
allShoesArticles.first { it.color == particleColor }.copy(id = id)
.also {
id++
}
shoesArticles.add(0, addedArticle)
isFired = true
}) {
Icon(Icons.Filled.AddCircle, contentDescription = null)
}
},
/* ... */
)
}
}
) { /* ... */ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment