pajatopmr
07/18/2022, 3:46 PMZach Klippenstein (he/him) [MOD]
07/18/2022, 3:53 PMpajatopmr
07/18/2022, 3:56 PMFilip Wiesner
07/18/2022, 3:56 PMLazyColumn {
item { Text("Item1") }
item { Text("Item2") }
}
Here you "remove" Item 2 by just not declaring it. This can be done for example with boolean flag.
LazyColumn {
item { Text("Item1") }
if (item2Displayed) {
item { Text("Item2") }
}
}
(This flag would have to be a State
so the UI gets updated on change)Zach Klippenstein (he/him) [MOD]
07/18/2022, 3:58 PMmutableStateListOf()
) or to store an immutable list in one (eg mutableStateOf()
). In both those cases, when you add/remove from those lists, your compose ui should automatically updatepajatopmr
07/18/2022, 4:00 PMFilip Wiesner
07/18/2022, 4:02 PMFilip Wiesner
07/18/2022, 4:03 PMpajatopmr
07/18/2022, 5:25 PMTobias Suchalla
07/19/2022, 5:35 AMtodoapp-lite
example may help:
https://github.com/JetBrains/compose-jb/tree/master/examples/todoapp-lite/common/src/commonMain/kotlin/example/todoapp/lite/common
Take a look at RootStore
. It holds the list (wrapped in RootState
) and provides methods to edit and remove items. Both are then used in MainContent
(via RootContent
).pajatopmr
07/22/2022, 6:38 PMpajatopmr
07/24/2022, 5:31 AM