Specify the language of the codelab if it is not English:
In which task and step of the codelab can this issue be found?
Implement sell item
Task: Add a function in the ViewModel
Step: 13. Run your app. Notice that the app disables the Sell button when the quantity in stock is zero.
Describe the problem
I have followed the instruction and run my app. But the Sell button didn't get disabled when the quantity in stock was zero. Another step is missing in the codelab script.
One more task that should be added next to the step 12 is below.
Go back to ItemDetailsScreen.kt. In the ItemDetailsBody composable, set the parameter named 'enabled' of the Button composable as !itemDetailsUiState.outOfStock.
URL of codelab: https://developer.android.com/codelabs/basic-android-kotlin-compose-update-data-room#7
Specify the language of the codelab if it is not English:
In which task and step of the codelab can this issue be found?
Describe the problem I have followed the instruction and run my app. But the Sell button didn't get disabled when the quantity in stock was zero. Another step is missing in the codelab script.
One more task that should be added next to the step 12 is below. Go back to ItemDetailsScreen.kt. In the ItemDetailsBody composable, set the parameter named 'enabled' of the Button composable as !itemDetailsUiState.outOfStock.
Additional information [Before] Button( onClick = onSellItem, modifier = Modifier.fillMaxWidth(), shape = MaterialTheme.shapes.small, enabled = true ) { Text(stringResource(R.string.sell)) }
[After] Button( onClick = onSellItem, modifier = Modifier.fillMaxWidth(), shape = MaterialTheme.shapes.small, enabled = !itemDetailsUiState.outOfStock ) { Text(stringResource(R.string.sell)) }