And this is what I'm suggesting(perhaps in addition to the above, at least mentioning it in the codelab as a possibility?) by avoiding code duplication:
VersionsAndroid Studio version:
Android Studio Electric Eel | 2022.1.1 Canary 9
Build #AI-221.5921.22.2211.8881706, built on July 28, 2022
Runtime version: 11.0.13+0-b1751.21-8125866 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.18.16-gentoo-x86_64
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
Current Desktop: LXQt
API version of the emulator:
doesn't matter.
Additional information
The simpler, perhaps also more idiomatic, way without duplicating code:
URL of codelab https://developer.android.com/codelabs/basic-android-kotlin-compose-material-theming?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-3-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-material-theming#3
In which task and step of the codelab can this issue be found?
4. Add color
in the section titledAdd dark theme
which is at about 80% scroll down.Describe the problem It seems a bit unnecessary to duplicate code in order to show the dark theme, why not use another
@Preview
annotation instead?This is what's currently there:
And this is what I'm suggesting(perhaps in addition to the above, at least mentioning it in the codelab as a possibility?) by avoiding code duplication:
(see the screenshot below to see how it looks)
Versions Android Studio version: Android Studio Electric Eel | 2022.1.1 Canary 9 Build #AI-221.5921.22.2211.8881706, built on July 28, 2022 Runtime version: 11.0.13+0-b1751.21-8125866 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 5.18.16-gentoo-x86_64 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 12 Registry: external.system.auto.import.disabled=true ide.text.editor.with.preview.show.floating.toolbar=false
Current Desktop: LXQt
API version of the emulator: doesn't matter.
Additional information The simpler, perhaps also more idiomatic, way without duplicating code: