Dùng MaterialTheme (Material 3) hoặc CompositionLocal tùy chỉnh để tập trung hóa các thuộc tính theme.
- Định nghĩa màu sắc, typography, và shape trong theme object, dùng
CompositionLocalProviderđể cung cấp chúng cho cây composable. - Wrap app trong
MaterialTheme(colorScheme = colorScheme, typography = typography) { App() }— lưu ý tham số làcolorScheme(Material 3), không phảicolors(Material 2). - Hỗ trợ dark/light mode qua
isSystemInDarkTheme().
Use MaterialTheme (Material 3) or custom CompositionLocal values to centralize theme properties.
- Define colors, typography, and shapes in a theme object, and use
CompositionLocalProviderto provide them to the composable tree. - Wrap your app in
MaterialTheme(colorScheme = colorScheme, typography = typography) { App() }— note the parameter iscolorScheme(Material 3), notcolors(Material 2). - Supports light/dark mode through
isSystemInDarkTheme().