mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-12 00:48:29 -04:00
Added KiwixDialogTheme
to ensure consistent dialog styling with the app's light and dark themes.
This commit is contained in:
parent
e153bfc38a
commit
0ed106cf81
@ -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.KiwixAppBar
|
||||||
import org.kiwix.kiwixmobile.core.ui.components.KiwixSnackbarHost
|
import org.kiwix.kiwixmobile.core.ui.components.KiwixSnackbarHost
|
||||||
import org.kiwix.kiwixmobile.core.ui.models.ActionMenuItem
|
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.FIVE_DP
|
||||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FOUR_DP
|
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FOUR_DP
|
||||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.MINIMUM_HEIGHT_OF_NOTE_TEXT_FILED
|
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.MINIMUM_HEIGHT_OF_NOTE_TEXT_FILED
|
||||||
@ -77,7 +77,7 @@ fun AddNoteDialogScreen(
|
|||||||
) {
|
) {
|
||||||
val focusRequester = remember { FocusRequester() }
|
val focusRequester = remember { FocusRequester() }
|
||||||
val focusManager = LocalFocusManager.current
|
val focusManager = LocalFocusManager.current
|
||||||
KiwixTheme {
|
KiwixDialogTheme {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
snackbarHost = { KiwixSnackbarHost(snackbarHostState = snackBarHostState) }
|
snackbarHost = { KiwixSnackbarHost(snackbarHostState = snackBarHostState) }
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
|
@ -26,6 +26,7 @@ val MineShaftGray350 = Color(0xFFD6D6D6)
|
|||||||
val MineShaftGray500 = Color(0xFF9E9E9E)
|
val MineShaftGray500 = Color(0xFF9E9E9E)
|
||||||
val ScorpionGray = Color(0xFF5A5A5A)
|
val ScorpionGray = Color(0xFF5A5A5A)
|
||||||
val MineShaftGray600 = Color(0xFF737373)
|
val MineShaftGray600 = Color(0xFF737373)
|
||||||
|
val MineShaftGray700 = Color(0xFF424242)
|
||||||
val MineShaftGray850 = Color(0xFF303030)
|
val MineShaftGray850 = Color(0xFF303030)
|
||||||
val MineShaftGray900 = Color(0xFF212121)
|
val MineShaftGray900 = Color(0xFF212121)
|
||||||
val Black = Color(0xFF000000)
|
val Black = Color(0xFF000000)
|
||||||
|
@ -34,7 +34,8 @@ private val DarkColorScheme = darkColorScheme(
|
|||||||
onSecondary = MineShaftGray350,
|
onSecondary = MineShaftGray350,
|
||||||
onBackground = White,
|
onBackground = White,
|
||||||
onSurface = White,
|
onSurface = White,
|
||||||
onError = White
|
onError = White,
|
||||||
|
onTertiary = MineShaftGray500
|
||||||
)
|
)
|
||||||
|
|
||||||
private val LightColorScheme = lightColorScheme(
|
private val LightColorScheme = lightColorScheme(
|
||||||
@ -47,7 +48,8 @@ private val LightColorScheme = lightColorScheme(
|
|||||||
onSecondary = ScorpionGray,
|
onSecondary = ScorpionGray,
|
||||||
onBackground = Black,
|
onBackground = Black,
|
||||||
onSurface = Black,
|
onSurface = Black,
|
||||||
onError = AlabasterWhite
|
onError = AlabasterWhite,
|
||||||
|
onTertiary = MineShaftGray600
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -67,3 +69,27 @@ fun KiwixTheme(
|
|||||||
typography = KiwixTypography
|
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
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user