This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LazyColumn( | |
horizontalAlignment = Alignment.CenterHorizontally, | |
modifier = Modifier | |
.fillMaxSize() | |
.background(AppTheme.colors.background) | |
) { | |
item { | |
TopAppBar( | |
title = { | |
Text( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun DemoScreen(items: List<PhotographItem>) { | |
LazyColumn( | |
horizontalAlignment = Alignment.CenterHorizontally, | |
modifier = Modifier | |
.fillMaxSize() | |
.background(AppTheme.colors.background) | |
) { | |
item { | |
TopAppBar( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setContent { | |
AppTheme { | |
DemoScreen(items = photographItems) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun AppTheme( | |
colors: AppColors = AppTheme.colors, | |
typography: AppTypography = AppTheme.typography, | |
dimensions: AppDimensions = AppTheme.dimensions, | |
content: @Composable () -> Unit | |
) { | |
// creating a new object for colors to not mutate the initial colors set when updating the values | |
val rememberedColors = remember { colors.copy() }.apply { updateColorsFrom(colors) } | |
CompositionLocalProvider( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun AppTheme( | |
colors: AppColors = AppTheme.colors, | |
typography: AppTypography = AppTheme.typography, | |
dimensions: AppDimensions = AppTheme.dimensions, | |
content: @Composable () -> Unit | |
) { | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class AppDimensions( | |
val paddingSmall: Dp = 4.dp, | |
val paddingMedium: Dp = 8.dp, | |
val paddingLarge: Dp = 24.dp | |
) | |
internal val LocalDimensions = staticCompositionLocalOf { AppDimensions() } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val rubik = FontFamily( | |
Font(R.font.rubik_regular, FontWeight.Normal) | |
) | |
private val openSans = FontFamily( | |
Font(R.font.open_sans_regular, FontWeight.Normal) | |
) | |
data class AppTypography( | |
val h1: TextStyle = TextStyle( | |
fontFamily = rubik, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun darkColors( | |
primary: Color = colorDarkPrimary, | |
textPrimary: Color = colorDarkTextPrimary, | |
textSecondary: Color = colorDarkTextSecondary, | |
background: Color = colorDarkBackground, | |
error: Color = colorDarkError | |
): AppColors = AppColors( | |
primary = primary, | |
textPrimary = textPrimary, | |
textSecondary = textSecondary, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun lightColors( | |
primary: Color = colorLightPrimary, | |
textPrimary: Color = colorLightTextPrimary, | |
textSecondary: Color = colorLightTextSecondary, | |
background: Color = colorLightBackground, | |
error: Color = colorLightError | |
): AppColors = AppColors( | |
primary = primary, | |
textPrimary = textPrimary, | |
textSecondary = textSecondary, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val colorLightPrimary = Color(0xFFFFB400) | |
private val colorLightTextPrimary = Color(0xFF000000) | |
private val colorLightTextSecondary = Color(0xFF6C727A) | |
private val colorLightBackground = Color(0xFFFFFFFF) | |
private val colorLightError = Color(0xFFD62222) |