Added KiwixDialogTheme to ensure consistent dialog styling with the app's light and dark themes.

This commit is contained in:
MohitMaliFtechiz 2025-03-11 15:31:01 +05:30
parent e153bfc38a
commit 0ed106cf81
3 changed files with 31 additions and 4 deletions

View File

@ -51,7 +51,7 @@ import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.core.ui.components.KiwixAppBar
import org.kiwix.kiwixmobile.core.ui.components.KiwixSnackbarHost
import org.kiwix.kiwixmobile.core.ui.models.ActionMenuItem
import org.kiwix.kiwixmobile.core.ui.theme.KiwixTheme
import org.kiwix.kiwixmobile.core.ui.theme.KiwixDialogTheme
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FIVE_DP
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FOUR_DP
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.MINIMUM_HEIGHT_OF_NOTE_TEXT_FILED
@ -77,7 +77,7 @@ fun AddNoteDialogScreen(
) {
val focusRequester = remember { FocusRequester() }
val focusManager = LocalFocusManager.current
KiwixTheme {
KiwixDialogTheme {
Scaffold(
snackbarHost = { KiwixSnackbarHost(snackbarHostState = snackBarHostState) }
) { paddingValues ->

View File

@ -26,6 +26,7 @@ val MineShaftGray350 = Color(0xFFD6D6D6)
val MineShaftGray500 = Color(0xFF9E9E9E)
val ScorpionGray = Color(0xFF5A5A5A)
val MineShaftGray600 = Color(0xFF737373)
val MineShaftGray700 = Color(0xFF424242)
val MineShaftGray850 = Color(0xFF303030)
val MineShaftGray900 = Color(0xFF212121)
val Black = Color(0xFF000000)

View File

@ -34,7 +34,8 @@ private val DarkColorScheme = darkColorScheme(
onSecondary = MineShaftGray350,
onBackground = White,
onSurface = White,
onError = White
onError = White,
onTertiary = MineShaftGray500
)
private val LightColorScheme = lightColorScheme(
@ -47,7 +48,8 @@ private val LightColorScheme = lightColorScheme(
onSecondary = ScorpionGray,
onBackground = Black,
onSurface = Black,
onError = AlabasterWhite
onError = AlabasterWhite,
onTertiary = MineShaftGray600
)
@Composable
@ -67,3 +69,27 @@ fun KiwixTheme(
typography = KiwixTypography
)
}
/**
* A custom MaterialTheme specifically for dialogs in the Kiwix app.
*
* This theme applies a modified dark mode background for dialogs while keeping
* the rest of the color scheme unchanged. In light mode, it uses the
* standard app theme(KiwixTheme).
*/
@Composable
fun KiwixDialogTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit
) {
val colorScheme = when {
darkTheme -> DarkColorScheme.copy(background = MineShaftGray700)
else -> LightColorScheme
}
MaterialTheme(
colorScheme = colorScheme,
content = content,
shapes = shapes,
typography = KiwixTypography
)
}