Fix outline button colors

This commit is contained in:
andrew 2023-08-31 12:35:15 +09:30
parent e95c842051
commit bc83c3da52
2 changed files with 10 additions and 4 deletions

View File

@ -61,6 +61,7 @@ import org.thoughtcrime.securesms.ui.AppTheme
import org.thoughtcrime.securesms.ui.CellNoMargin import org.thoughtcrime.securesms.ui.CellNoMargin
import org.thoughtcrime.securesms.ui.Divider import org.thoughtcrime.securesms.ui.Divider
import org.thoughtcrime.securesms.ui.GetString import org.thoughtcrime.securesms.ui.GetString
import org.thoughtcrime.securesms.ui.LocalExtraColors
import org.thoughtcrime.securesms.ui.PreviewTheme import org.thoughtcrime.securesms.ui.PreviewTheme
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
@ -302,9 +303,12 @@ fun OutlineButton(text: String, modifier: Modifier = Modifier, onClick: () -> Un
OutlinedButton( OutlinedButton(
modifier = modifier.size(108.dp, 34.dp), modifier = modifier.size(108.dp, 34.dp),
onClick = onClick, onClick = onClick,
border = BorderStroke(1.dp, MaterialTheme.colors.secondary), border = BorderStroke(1.dp, LocalExtraColors.current.prominentButtonColor),
shape = RoundedCornerShape(50), // = 50% percent shape = RoundedCornerShape(50), // = 50% percent
colors = ButtonDefaults.outlinedButtonColors(contentColor = MaterialTheme.colors.secondary) colors = ButtonDefaults.outlinedButtonColors(
contentColor = LocalExtraColors.current.prominentButtonColor,
backgroundColor = MaterialTheme.colors.background
)
){ ){
Text(text = text) Text(text = text)
} }
@ -312,7 +316,7 @@ fun OutlineButton(text: String, modifier: Modifier = Modifier, onClick: () -> Un
@Preview(widthDp = 450, heightDp = 700) @Preview(widthDp = 450, heightDp = 700)
@Composable @Composable
fun x( fun PreviewStates(
@PreviewParameter(StatePreviewParameterProvider::class) state: State @PreviewParameter(StatePreviewParameterProvider::class) state: State
) { ) {
PreviewTheme(R.style.Classic_Dark) { PreviewTheme(R.style.Classic_Dark) {
@ -347,7 +351,7 @@ class StatePreviewParameterProvider : PreviewParameterProvider<State> {
@Preview @Preview
@Composable @Composable
fun PreviewMessageDetails( fun PreviewThemes(
@PreviewParameter(ThemeResPreviewParameterProvider::class) themeResId: Int @PreviewParameter(ThemeResPreviewParameterProvider::class) themeResId: Int
) { ) {
PreviewTheme(themeResId) { PreviewTheme(themeResId) {

View File

@ -22,6 +22,7 @@ val LocalExtraColors = staticCompositionLocalOf<ExtraColors> { error("No Custom
data class ExtraColors( data class ExtraColors(
val settingsBackground: Color, val settingsBackground: Color,
val prominentButtonColor: Color
) )
/** /**
@ -34,6 +35,7 @@ fun AppTheme(
val extraColors = LocalContext.current.run { val extraColors = LocalContext.current.run {
ExtraColors( ExtraColors(
settingsBackground = getColorFromTheme(R.attr.colorSettingsBackground), settingsBackground = getColorFromTheme(R.attr.colorSettingsBackground),
prominentButtonColor = getColorFromTheme(R.attr.prominentButtonColor),
) )
} }