Skip to content

Commit

Permalink
lab06 fix: implement onCheckBoxClick
Browse files Browse the repository at this point in the history
  • Loading branch information
gazdilaci authored Oct 15, 2024
1 parent 98fe339 commit d2d2b30
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/laborok/06-android-room/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,21 @@ fun ShoppingListScreen(viewModel: ShoppingListViewModel = viewModel(factory = Sh

val list = viewModel.shoppingItemList.collectAsStateWithLifecycle().value

...
Scaffold(
...
) { innerPadding ->

LazyColumn(
modifier = Modifier.padding(innerPadding)
) {
items(list, key = { item -> item.id!! }) {

ItemShoppingItem(
shoppingItem = it,
onCheckBoxClick = { shoppingItem ->
viewModel.update(shoppingItem)
},
...

if (isDialogOpen) {
Dialog(onDismissRequest = { isDialogOpen = false }) {
Expand Down

0 comments on commit d2d2b30

Please sign in to comment.