google-developer-training / basic-android-kotlin-compose-birthday-card-app

Apache License 2.0
125 stars 95 forks source link

Text composables: Android Basics with Compose #908

Open DanTechwizard opened 6 days ago

DanTechwizard commented 6 days ago

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

In which task and step of the codelab can this issue be found? Task 5: Add a new text element

Describe the problem In the step 3 the code is missing the lambda expression after the Surface Composable is called.

It reads: Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) {

It should say something like:

Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { { GreetingText("Happy Birthday Daniel!") }

I am learning and took me a couple of days to figure what was happening. I had to learn lambda expressions.

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Just use that code in there in the lab and it will give you several errors. It needs to be corrected so people don't waste their time.

Versions Android Studio version: Android Studio Ladybug | 2024.2.1 Patch 2 API version of the emulator: 34

Additional information Include screenshots if they would be useful in clarifying the problem. image