Stage 2 · Lesson 10 of 10
Material 3 components and theming
in gives you ready-made components styled by MaterialTheme, such as Scaffold, TopAppBar, Button, Card and NavigationBar. A new project creates a Theme.kt file with a light and a dark ColorScheme, a Typography and Shapes.
isSystemInDarkTheme() picks the scheme. On Android 12 and later, can build the palette from the user's wallpaper. Components read MaterialTheme.colorScheme.surface or MaterialTheme.typography.titleMedium instead of fixed values.
So dark mode and a rebrand change one file. The Material Theme Builder creates schemes from a brand colour.
Common trapColor.White and 18.sp literals in every , which break in dark mode.
A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with
- CourseFreeAndroid Basics with Compose
Google · Beginner
Units 2 and 3: Compose layouts, state, scrollable lists and Material theming