google-developer-training / basic-android-kotlin-compose-training-unscramble

Apache License 2.0
98 stars 139 forks source link

Android Basics: Viewmodel and State in Compose #185

Closed dimifili123 closed 8 months ago

dimifili123 commented 8 months ago

Hi, in this tutorial i think there is a mistake:

https://developer.android.com/codelabs/basic-android-kotlin-compose-viewmodel-and-state?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-4-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-viewmodel-and-state#5

In the following step, the text parameter that has to change is not in the first text field. Its the second text field, based on the code in the starter branch.

  1. Update the GameLayout() composable function to display currentScrambledWord. Set the text parameter of the first text field in the column to currentScrambledWord.
@Composable
fun GameLayout(
   // ...
) {
   Column(
       verticalArrangement = Arrangement.spacedBy(24.dp)
   ) {
       Text(
           text = currentScrambledWord,
           fontSize = 45.sp,
           modifier = modifier.align(Alignment.CenterHorizontally)
       )
    //... 
    }
}