Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Android app: Android Basics in Compose - Step 7 does not teach the learner how to import dp #11

Closed
michaelssim opened this issue May 19, 2022 · 2 comments
Assignees

Comments

@michaelssim
Copy link

URL of codelab

In which task and step of the codelab can this issue be found?
Step 7: Adding padding

Describe the problem
When adding the new code: modifier = Modifier.padding(24.dp), the codelab should instruct the learner that dp must be imported or else the code won't work. This is probably the first time the learner has to import something so it's crucial to teach how to do this.

import androidx.compose.ui.unit.dp

How to improve it
image

Here's an example:
"Notice that when you add a padding modifier to the text with a size of 24.dp, the dp text is red. This is happening because you need to import dp first in order for your code to compile. Fixing this error is simple thanks to Android Studio. Simply highlight the text and press Alt+Enter in PC/Linux or Option+Enter in Mac. Import should be highlighted by default so just press Enter.

image

If you don't do this and try Build & Refresh, you will get an "Unresolved reference: dp" error."

image

@michaelssim michaelssim changed the title First Android app: Android Basics in Compose First Android app: Android Basics in Compose - Step 7 does not teach the learner how to import dp May 19, 2022
@michaelssim
Copy link
Author

michaelssim commented May 21, 2022

import dp is taught for the first time in Pathway 3, Build a simple app with text composables, Section 7: Change font size: https://developer.android.com/codelabs/basic-android-kotlin-compose-text-composables

image

Comment
As mentioned in the original issue, this should be taught earlier because the discussion of dp happens before the learner reaches Pathway 3. So this is being taught a step late.

@osuleymanova osuleymanova self-assigned this Jul 20, 2022
@osuleymanova
Copy link
Contributor

@michaelssim
The issue that you presented to us is extremely important, and I thank you for bringing it to our attention. The content of the codelab was updated and published:

Screen Shot 2022-07-25 at 3 22 26 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants