From cb2024d6414b6d7a760424e4b6002cd26ce1cff6 Mon Sep 17 00:00:00 2001 From: revanthkumarJ Date: Fri, 27 Dec 2024 11:19:17 +0530 Subject: [PATCH] Used CompositionLocalProvider --- .../mifos/mobile/core/designsystem/theme/Theme.kt | 15 +++++++++++---- .../mobile/feature/about/ui/AboutUsScreen.kt | 3 --- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/designsystem/src/main/kotlin/org/mifos/mobile/core/designsystem/theme/Theme.kt b/core/designsystem/src/main/kotlin/org/mifos/mobile/core/designsystem/theme/Theme.kt index b3e2da1f8..b4123ee90 100644 --- a/core/designsystem/src/main/kotlin/org/mifos/mobile/core/designsystem/theme/Theme.kt +++ b/core/designsystem/src/main/kotlin/org/mifos/mobile/core/designsystem/theme/Theme.kt @@ -14,6 +14,7 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.graphics.Color private val LightThemeColors = lightColorScheme( @@ -50,8 +51,14 @@ fun MifosMobileTheme( else -> LightThemeColors } - MaterialTheme( - colorScheme = colors, - content = content, - ) + val backgroundTheme = if (useDarkTheme) BackgroundDark else BackgroundLight + + CompositionLocalProvider( + LocalBackgroundTheme provides BackgroundTheme(backgroundTheme), + ) { + MaterialTheme( + colorScheme = colors, + content = content, + ) + } } diff --git a/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/AboutUsScreen.kt b/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/AboutUsScreen.kt index 8fe74b8a3..f8c6aff83 100644 --- a/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/AboutUsScreen.kt +++ b/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/AboutUsScreen.kt @@ -10,14 +10,12 @@ package org.mifos.mobile.feature.about.ui import android.content.Context -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext @@ -40,7 +38,6 @@ internal fun AboutUsScreen( LazyColumn( modifier = modifier .fillMaxSize() - .background(MaterialTheme.colorScheme.background) .padding(16.dp), ) { item {