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

Apache License 2.0
56 stars 87 forks source link

Material Theming: Android Basics in Compose #27

Closed bewareOfCats closed 1 year ago

bewareOfCats commented 1 year ago

Hello all.

URL of codelab https://developer.android.com/codelabs/basic-android-kotlin-compose-material-theming?hl=fr&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-3-pathway-3%3Fhl%3Dfr%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-material-theming#7

In which task and step of the codelab can this issue be found?

Describe the problem

  1. -I got the Error : "Content padding parameter is not used " when use this code bellow. At the End, even with this Error Message, sometimes, the App is running 'correctly'. May be, this should just be a warning Message From Android Studio ?!
@Composable
fun WoofApp() {
    Scaffold(
        topBar = { WoofTopBar() }
    ) {

        LazyColumn(
            modifier = Modifier
                .background(MaterialTheme.colors.background)
        ) {
            items(dogs) {
                DogItem(dog = it)
            }
        }
    }

}
  1. I resolve it by adding (trailing function) paddingValue -> and by adding Modifier.padding(paddingValue) to the main content Composable(LazyColumn) using the answer from Hasan Çobanoğlu at https://stackoverflow.com/questions/72084865/content-padding-parameter-it-is-not-used

@Composable fun WoofApp2() { Scaffold( topBar = { WoofTopBar()} ) { paddingValues ->

    LazyColumn(modifier = Modifier
        .background(MaterialTheme.colors.background)
        .padding(paddingValues)) {
        items(dogs) {
            DogItem(dog = it)
        }
    }
}

}

Versions Android Studio version: API version of the emulator:

Android Studio Electric Eel | 2022.1.1 Patch 1 Build #AI-221.6008.13.2211.9514443, built on January 21, 2023 Runtime version: 11.0.15+0-b2043.56-9505619 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Memory: 1280M

osuleymanova commented 1 year ago

Hello @bewareOfCats,

Thank you for reaching out and sharing your concern. From the moment you reported the problem, the contents of codelab, as well as the starter and main branches of the code have been updated. So please check out the updated versions. Following the steps in the codelab, you should have the following code:

Screenshot 2023-06-14 at 2 32 49 PM

In case you still face an issue, please feel free to open a new ticket.

Happy Android learning!