Skip to content

Commit 7595d50

Browse files
fix: implement material theme
1 parent 8bd674a commit 7595d50

File tree

27 files changed

+242
-124
lines changed

27 files changed

+242
-124
lines changed

compose_compiler_config.conf

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This file contains classes (with possible wildcards) that the Compose Compiler will treat as stable.
2+
// It allows us to define classes that our not part of our codebase without wrapping them in a stable class.
3+
// For more information, check https://developer.android.com/jetpack/compose/performance/stability/fix#configuration-file
4+
5+
java.time.ZoneId
6+
java.time.ZoneOffset

core/designsystem/src/main/java/org/mifos/mobilewallet/mifospay/designsystem/theme/Color.kt

-23
This file was deleted.

core/designsystem/src/main/java/org/mifos/mobilewallet/mifospay/designsystem/theme/Theme.kt

-67
This file was deleted.

core/designsystem/src/main/java/org/mifos/mobilewallet/mifospay/designsystem/component/TopAppBar.kt core/designsystem/src/main/kotlin/org/mifos/mobilewallet/mifospay/designsystem/component/TopAppBar.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
@file:OptIn(ExperimentalMaterial3Api::class)
3+
14
package org.mifos.mobilewallet.mifospay.designsystem.component
25

36
import androidx.annotation.StringRes
@@ -54,14 +57,14 @@ fun MifosTopAppBar(
5457
}
5558
},
5659
colors = colors,
57-
modifier = modifier.testTag("niaTopAppBar"),
60+
modifier = modifier.testTag("mifosTopAppBar"),
5861
)
5962
}
6063

6164
@OptIn(ExperimentalMaterial3Api::class)
6265
@Preview("Top App Bar")
6366
@Composable
64-
private fun NiaTopAppBarPreview() {
67+
private fun MifosTopAppBarPreview() {
6568
MifosTheme {
6669
MifosTopAppBar(
6770
titleRes = android.R.string.untitled,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package org.mifos.mobilewallet.mifospay.designsystem.theme
2+
3+
import androidx.compose.ui.graphics.Color
4+
5+
val md_theme_light_primary = Color(0xFF984061)
6+
val md_theme_light_onPrimary = Color(0xFFFFFFFF)
7+
val md_theme_light_primaryContainer = Color(0xFFFFD9E2)
8+
val md_theme_light_onPrimaryContainer = Color(0xFF3E001D)
9+
val md_theme_light_secondary = Color(0xFF984061)
10+
val md_theme_light_onSecondary = Color(0xFFFFFFFF)
11+
val md_theme_light_secondaryContainer = Color(0xFFFFD9E2)
12+
val md_theme_light_onSecondaryContainer = Color(0xFF3E001D)
13+
val md_theme_light_tertiary = Color(0xFF7D4996)
14+
val md_theme_light_onTertiary = Color(0xFFFFFFFF)
15+
val md_theme_light_tertiaryContainer = Color(0xFFF6D9FF)
16+
val md_theme_light_onTertiaryContainer = Color(0xFF310049)
17+
val md_theme_light_error = Color(0xFFBA1A1A)
18+
val md_theme_light_errorContainer = Color(0xFFFFDAD6)
19+
val md_theme_light_onError = Color(0xFFFFFFFF)
20+
val md_theme_light_onErrorContainer = Color(0xFF410002)
21+
val md_theme_light_background = Color(0xFFFFFBFF)
22+
val md_theme_light_onBackground = Color(0xFF330045)
23+
val md_theme_light_surface = Color(0xFFFFFBFF)
24+
val md_theme_light_onSurface = Color(0xFF330045)
25+
val md_theme_light_surfaceVariant = Color(0xFFF2DDE1)
26+
val md_theme_light_onSurfaceVariant = Color(0xFF514347)
27+
val md_theme_light_outline = Color(0xFF837377)
28+
val md_theme_light_inverseOnSurface = Color(0xFFFFEBFF)
29+
val md_theme_light_inverseSurface = Color(0xFF4D1661)
30+
val md_theme_light_inversePrimary = Color(0xFFFFB1C8)
31+
val md_theme_light_shadow = Color(0xFF000000)
32+
val md_theme_light_surfaceTint = Color(0xFF984061)
33+
val md_theme_light_outlineVariant = Color(0xFFD5C2C6)
34+
val md_theme_light_scrim = Color(0xFF000000)
35+
36+
val md_theme_dark_primary = Color(0xFFFFB1C8)
37+
val md_theme_dark_onPrimary = Color(0xFF5E1133)
38+
val md_theme_dark_primaryContainer = Color(0xFF7B2949)
39+
val md_theme_dark_onPrimaryContainer = Color(0xFFFFD9E2)
40+
val md_theme_dark_secondary = Color(0xFFFFB1C8)
41+
val md_theme_dark_onSecondary = Color(0xFF5E1133)
42+
val md_theme_dark_secondaryContainer = Color(0xFF7B2949)
43+
val md_theme_dark_onSecondaryContainer = Color(0xFFFFD9E2)
44+
val md_theme_dark_tertiary = Color(0xFFE8B3FF)
45+
val md_theme_dark_onTertiary = Color(0xFF4A1764)
46+
val md_theme_dark_tertiaryContainer = Color(0xFF63307C)
47+
val md_theme_dark_onTertiaryContainer = Color(0xFFF6D9FF)
48+
val md_theme_dark_error = Color(0xFFFFB4AB)
49+
val md_theme_dark_errorContainer = Color(0xFF93000A)
50+
val md_theme_dark_onError = Color(0xFF690005)
51+
val md_theme_dark_onErrorContainer = Color(0xFFFFDAD6)
52+
val md_theme_dark_background = Color(0xFF330045)
53+
val md_theme_dark_onBackground = Color(0xFFFAD7FF)
54+
val md_theme_dark_surface = Color(0xFF330045)
55+
val md_theme_dark_onSurface = Color(0xFFFAD7FF)
56+
val md_theme_dark_surfaceVariant = Color(0xFF514347)
57+
val md_theme_dark_onSurfaceVariant = Color(0xFFD5C2C6)
58+
val md_theme_dark_outline = Color(0xFF9E8C90)
59+
val md_theme_dark_inverseOnSurface = Color(0xFF330045)
60+
val md_theme_dark_inverseSurface = Color(0xFFFAD7FF)
61+
val md_theme_dark_inversePrimary = Color(0xFF984061)
62+
val md_theme_dark_shadow = Color(0xFF000000)
63+
val md_theme_dark_surfaceTint = Color(0xFFFFB1C8)
64+
val md_theme_dark_outlineVariant = Color(0xFF514347)
65+
val md_theme_dark_scrim = Color(0xFF000000)
66+
67+
// colors
68+
val black = Color(0xFF000000)
69+
val grey = Color(0xFF757074)
70+
val lightGrey = Color(0xFFD9D9D9)
71+
val border = Color(0x66000000)
72+
val green = Color(0xFF008135)
73+
val red = Color(0xFFCD0000)
74+
val mifosText = Color(0xFF212121)
75+
val chipSelectedColor = Color(0xFF00BFFF)
76+
val creditTextColor = Color(0xFF009688)
77+
val debitTextColor = Color(0xFFF10606)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
package org.mifos.mobilewallet.mifospay.designsystem.theme
2+
3+
import androidx.compose.foundation.isSystemInDarkTheme
4+
import androidx.compose.material3.MaterialTheme
5+
import androidx.compose.material3.darkColorScheme
6+
import androidx.compose.material3.lightColorScheme
7+
import androidx.compose.runtime.Composable
8+
import androidx.compose.runtime.CompositionLocalProvider
9+
import androidx.compose.ui.unit.dp
10+
11+
private val LightDefaultColorScheme = lightColorScheme(
12+
primary = md_theme_light_primary,
13+
onPrimary = md_theme_light_onPrimary,
14+
primaryContainer = md_theme_light_primaryContainer,
15+
onPrimaryContainer = md_theme_light_onPrimaryContainer,
16+
secondary = md_theme_light_secondary,
17+
onSecondary = md_theme_light_onSecondary,
18+
secondaryContainer = md_theme_light_secondaryContainer,
19+
onSecondaryContainer = md_theme_light_onSecondaryContainer,
20+
tertiary = md_theme_light_tertiary,
21+
onTertiary = md_theme_light_onTertiary,
22+
tertiaryContainer = md_theme_light_tertiaryContainer,
23+
onTertiaryContainer = md_theme_light_onTertiaryContainer,
24+
error = md_theme_light_error,
25+
errorContainer = md_theme_light_errorContainer,
26+
onError = md_theme_light_onError,
27+
onErrorContainer = md_theme_light_onErrorContainer,
28+
background = md_theme_light_background,
29+
onBackground = md_theme_light_onBackground,
30+
surface = md_theme_light_surface,
31+
onSurface = md_theme_light_onSurface,
32+
surfaceVariant = md_theme_light_surfaceVariant,
33+
onSurfaceVariant = md_theme_light_onSurfaceVariant,
34+
outline = md_theme_light_outline,
35+
inverseOnSurface = md_theme_light_inverseOnSurface,
36+
inverseSurface = md_theme_light_inverseSurface,
37+
inversePrimary = md_theme_light_inversePrimary,
38+
surfaceTint = md_theme_light_surfaceTint,
39+
outlineVariant = md_theme_light_outlineVariant,
40+
scrim = md_theme_light_scrim,
41+
)
42+
43+
44+
private val DarkDefaultColorScheme = darkColorScheme(
45+
primary = md_theme_dark_primary,
46+
onPrimary = md_theme_dark_onPrimary,
47+
primaryContainer = md_theme_dark_primaryContainer,
48+
onPrimaryContainer = md_theme_dark_onPrimaryContainer,
49+
secondary = md_theme_dark_secondary,
50+
onSecondary = md_theme_dark_onSecondary,
51+
secondaryContainer = md_theme_dark_secondaryContainer,
52+
onSecondaryContainer = md_theme_dark_onSecondaryContainer,
53+
tertiary = md_theme_dark_tertiary,
54+
onTertiary = md_theme_dark_onTertiary,
55+
tertiaryContainer = md_theme_dark_tertiaryContainer,
56+
onTertiaryContainer = md_theme_dark_onTertiaryContainer,
57+
error = md_theme_dark_error,
58+
errorContainer = md_theme_dark_errorContainer,
59+
onError = md_theme_dark_onError,
60+
onErrorContainer = md_theme_dark_onErrorContainer,
61+
background = md_theme_dark_background,
62+
onBackground = md_theme_dark_onBackground,
63+
surface = md_theme_dark_surface,
64+
onSurface = md_theme_dark_onSurface,
65+
surfaceVariant = md_theme_dark_surfaceVariant,
66+
onSurfaceVariant = md_theme_dark_onSurfaceVariant,
67+
outline = md_theme_dark_outline,
68+
inverseOnSurface = md_theme_dark_inverseOnSurface,
69+
inverseSurface = md_theme_dark_inverseSurface,
70+
inversePrimary = md_theme_dark_inversePrimary,
71+
surfaceTint = md_theme_dark_surfaceTint,
72+
outlineVariant = md_theme_dark_outlineVariant,
73+
scrim = md_theme_dark_scrim,
74+
)
75+
76+
@Composable
77+
fun MifosTheme(
78+
darkTheme: Boolean = isSystemInDarkTheme(),
79+
// Dynamic color is available on Android 12+
80+
dynamicColor: Boolean = true,
81+
content: @Composable () -> Unit
82+
) {
83+
// Color scheme
84+
val colorScheme = when {
85+
else -> if (darkTheme) DarkDefaultColorScheme else LightDefaultColorScheme
86+
}
87+
val defaultGradientColors = GradientColors(
88+
top = colorScheme.inverseOnSurface,
89+
bottom = colorScheme.primaryContainer,
90+
container = colorScheme.surface,
91+
)
92+
val gradientColors = when {
93+
else -> defaultGradientColors
94+
}
95+
// Background theme
96+
val defaultBackgroundTheme = BackgroundTheme(
97+
color = colorScheme.surface,
98+
tonalElevation = 2.dp,
99+
)
100+
val backgroundTheme = when {
101+
else -> defaultBackgroundTheme
102+
}
103+
val tintTheme = when {
104+
else -> TintTheme()
105+
}
106+
// Composition locals
107+
CompositionLocalProvider(
108+
LocalGradientColors provides gradientColors,
109+
LocalBackgroundTheme provides backgroundTheme,
110+
LocalTintTheme provides tintTheme,
111+
) {
112+
MaterialTheme(
113+
colorScheme = colorScheme,
114+
typography = MifosTypography,
115+
content = content,
116+
)
117+
}
118+
}

0 commit comments

Comments
 (0)