Merge pull request #1088 from vector-im/fix/jme/1077-textbuttons-in-dark-theme
Fix TextButtons being displayed in black
This commit is contained in:
commit
486aca8598
13 changed files with 88 additions and 81 deletions
1
changelog.d/1077.bugfix
Normal file
1
changelog.d/1077.bugfix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Fix `TextButtons` being displayed in black.
|
||||||
|
|
@ -29,7 +29,9 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.systemBarsPadding
|
import androidx.compose.foundation.layout.systemBarsPadding
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.BiasAbsoluteAlignment
|
import androidx.compose.ui.BiasAbsoluteAlignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -132,73 +134,75 @@ private fun WaitListContent(
|
||||||
onCancelClicked: () -> Unit,
|
onCancelClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Box(
|
ElementTheme(
|
||||||
modifier = modifier
|
darkTheme = true
|
||||||
.fillMaxSize()
|
|
||||||
.systemBarsPadding()
|
|
||||||
.padding(horizontal = 16.dp, vertical = 16.dp)
|
|
||||||
) {
|
) {
|
||||||
if (state.loginAction !is Async.Success) {
|
|
||||||
ElementTheme(darkTheme = true) {
|
|
||||||
TextButton(
|
|
||||||
text = stringResource(CommonStrings.action_cancel),
|
|
||||||
onClick = onCancelClicked,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = modifier
|
||||||
contentAlignment = BiasAbsoluteAlignment(
|
.fillMaxSize()
|
||||||
horizontalBias = 0f,
|
.systemBarsPadding()
|
||||||
verticalBias = -0.05f
|
.padding(horizontal = 16.dp, vertical = 16.dp)
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Column(
|
if (state.loginAction !is Async.Success) {
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
CompositionLocalProvider(LocalContentColor provides Color.Black) {
|
||||||
) {
|
TextButton(
|
||||||
if (state.loginAction.isLoading()) {
|
text = stringResource(CommonStrings.action_cancel),
|
||||||
CircularProgressIndicator(
|
onClick = onCancelClicked,
|
||||||
modifier = Modifier.size(24.dp),
|
|
||||||
strokeWidth = 2.dp,
|
|
||||||
color = Color.White
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
|
||||||
}
|
|
||||||
Spacer(modifier = Modifier.height(18.dp))
|
|
||||||
val titleRes = when (state.loginAction) {
|
|
||||||
is Async.Success -> R.string.screen_waitlist_title_success
|
|
||||||
else -> R.string.screen_waitlist_title
|
|
||||||
}
|
|
||||||
Text(
|
|
||||||
text = withColoredPeriod(titleRes),
|
|
||||||
style = ElementTheme.typography.fontHeadingXlBold,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
color = Color.White,
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
val subtitle = when (state.loginAction) {
|
|
||||||
is Async.Success -> stringResource(
|
|
||||||
id = R.string.screen_waitlist_message_success,
|
|
||||||
state.appName,
|
|
||||||
)
|
|
||||||
else -> stringResource(
|
|
||||||
id = R.string.screen_waitlist_message,
|
|
||||||
state.appName,
|
|
||||||
state.serverName,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Text(
|
|
||||||
modifier = Modifier.widthIn(max = 360.dp),
|
|
||||||
text = subtitle,
|
|
||||||
style = ElementTheme.typography.fontBodyLgRegular,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
color = Color.White,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
Box(
|
||||||
if (state.loginAction is Async.Success) {
|
modifier = Modifier.fillMaxSize(),
|
||||||
ElementTheme(darkTheme = true) {
|
contentAlignment = BiasAbsoluteAlignment(
|
||||||
|
horizontalBias = 0f,
|
||||||
|
verticalBias = -0.05f
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
if (state.loginAction.isLoading()) {
|
||||||
|
CircularProgressIndicator(
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
strokeWidth = 2.dp,
|
||||||
|
color = ElementTheme.colors.iconPrimary
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.height(18.dp))
|
||||||
|
val titleRes = when (state.loginAction) {
|
||||||
|
is Async.Success -> R.string.screen_waitlist_title_success
|
||||||
|
else -> R.string.screen_waitlist_title
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
text = withColoredPeriod(titleRes),
|
||||||
|
style = ElementTheme.typography.fontHeadingXlBold,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
color = ElementTheme.colors.textPrimary,
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
val subtitle = when (state.loginAction) {
|
||||||
|
is Async.Success -> stringResource(
|
||||||
|
id = R.string.screen_waitlist_message_success,
|
||||||
|
state.appName,
|
||||||
|
)
|
||||||
|
else -> stringResource(
|
||||||
|
id = R.string.screen_waitlist_message,
|
||||||
|
state.appName,
|
||||||
|
state.serverName,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.widthIn(max = 360.dp),
|
||||||
|
text = subtitle,
|
||||||
|
style = ElementTheme.typography.fontBodyLgRegular,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
color = ElementTheme.colors.textPrimary,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state.loginAction is Async.Success) {
|
||||||
Button(
|
Button(
|
||||||
text = stringResource(id = CommonStrings.action_continue),
|
text = stringResource(id = CommonStrings.action_continue),
|
||||||
onClick = { state.eventSink.invoke(WaitListEvents.Continue) },
|
onClick = { state.eventSink.invoke(WaitListEvents.Continue) },
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package io.element.android.libraries.theme
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.material3.ColorScheme
|
import androidx.compose.material3.ColorScheme
|
||||||
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Typography
|
import androidx.compose.material3.Typography
|
||||||
import androidx.compose.material3.dynamicDarkColorScheme
|
import androidx.compose.material3.dynamicDarkColorScheme
|
||||||
|
|
@ -115,6 +116,7 @@ fun ElementTheme(
|
||||||
}
|
}
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalCompoundColors provides currentCompoundColor,
|
LocalCompoundColors provides currentCompoundColor,
|
||||||
|
LocalContentColor provides colorScheme.onSurface,
|
||||||
) {
|
) {
|
||||||
MaterialTheme(
|
MaterialTheme(
|
||||||
colorScheme = colorScheme,
|
colorScheme = colorScheme,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:f8b4d29ada2ed28a892fe9e53999164b32a1e0048a1f0e174c7178cefeae9d99
|
oid sha256:ce7cb3f4a50912cd7aa96340ff850d438a26e5efc331173c658448fdbecc7b65
|
||||||
size 147780
|
size 145047
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:f9980d21d32419e6dff77c8e75b98b5a6f968b60286e78fdf97b9f8c09c15fcb
|
oid sha256:b06c44fcc0afee1a398dbddeb18253f25002c3c8e77929d049edd878b3927e8a
|
||||||
size 148543
|
size 145776
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:9cddecc7cb469183ec37ad7f13a89961a67f463fb6c4856834e9e5ae176719c2
|
oid sha256:a212264caa4fa3c46e9bed62f62a01bf33f969f6da0da454899c3def9cc7e35a
|
||||||
size 63638
|
size 64104
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:f8b4d29ada2ed28a892fe9e53999164b32a1e0048a1f0e174c7178cefeae9d99
|
oid sha256:ce7cb3f4a50912cd7aa96340ff850d438a26e5efc331173c658448fdbecc7b65
|
||||||
size 147780
|
size 145047
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:f7ba1c3ae2350c5899d7df007efd59d9e7ccffeefadc02a7fa5b15a37bdaa2f1
|
oid sha256:ddf3e62bd00f179fbeed4e432bd9a7a21321e83dd1d5192e3dc213fcfbc8c372
|
||||||
size 128785
|
size 128199
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:6f493ce72952243e8826b17e03a74aa8aa16d24278fac8338b3e2db5354e61f2
|
oid sha256:ce7cb3f4a50912cd7aa96340ff850d438a26e5efc331173c658448fdbecc7b65
|
||||||
size 148553
|
size 145047
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:65e4dfe4c8fbb01233501750d34bfd8b6f84d153f21ba367c74efe87bd2359f0
|
oid sha256:b06c44fcc0afee1a398dbddeb18253f25002c3c8e77929d049edd878b3927e8a
|
||||||
size 149191
|
size 145776
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:4da187c6d9518b9e6269c202e3c388d22d866faa80541dbf06491dc0b7502794
|
oid sha256:30a12c0e23d30c5841fef2f705af3fc4ea691ff06425d84a5c33f34809b78d8c
|
||||||
size 65587
|
size 65492
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:6f493ce72952243e8826b17e03a74aa8aa16d24278fac8338b3e2db5354e61f2
|
oid sha256:ce7cb3f4a50912cd7aa96340ff850d438a26e5efc331173c658448fdbecc7b65
|
||||||
size 148553
|
size 145047
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:f7ba1c3ae2350c5899d7df007efd59d9e7ccffeefadc02a7fa5b15a37bdaa2f1
|
oid sha256:ddf3e62bd00f179fbeed4e432bd9a7a21321e83dd1d5192e3dc213fcfbc8c372
|
||||||
size 128785
|
size 128199
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue