Skip to content

Commit

Permalink
Fix inconsistent card color caused by Compose update (#1907)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurKun21 authored Nov 21, 2024
1 parent 05026dc commit 8609c8b
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand Down Expand Up @@ -141,7 +142,11 @@ private fun BattleConfigContent(
item {
Card(
modifier = Modifier
.padding(16.dp)
.padding(16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column {
config.name.EditTextPreference(
Expand All @@ -163,7 +168,11 @@ private fun BattleConfigContent(
Card(
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(bottom = 16.dp)
.padding(bottom = 16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
SkillCommandGroup(
config = config,
Expand All @@ -177,7 +186,11 @@ private fun BattleConfigContent(
Card(
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(bottom = 5.dp)
.padding(bottom = 5.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column {
Row(
Expand Down Expand Up @@ -274,7 +287,12 @@ private fun CardPrioritySummary(cardPriority: CardPriorityPerWave) {
style = MaterialTheme.typography.bodyMedium
)

Card {
Card(
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
val priorityString = buildAnnotatedString {
priorities.forEachIndexed { index, it ->
if (index != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
Expand All @@ -24,7 +26,11 @@ fun ShuffleCardsGroup(config: BattleConfigCore) {
Card(
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(bottom = 16.dp)
.padding(bottom = 16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.foundation.shape.CutCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Star
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.CardDefaults.cardElevation
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -66,7 +67,11 @@ fun SupportGroup(
Card(
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(bottom = 16.dp)
.padding(bottom = 16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column(
modifier = Modifier
Expand Down Expand Up @@ -167,7 +172,11 @@ fun SupportClassPicker(
elevation = cardElevation(2.dp),
modifier = Modifier
.padding(16.dp, 5.dp)
.fillMaxWidth()
.fillMaxWidth(),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
LazyRow(
modifier = Modifier
Expand Down Expand Up @@ -261,7 +270,11 @@ fun PreferredSummary(

if (servants.isNotEmpty()) {
Card(
elevation = cardElevation(2.dp)
elevation = cardElevation(2.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Text(
maxSkillText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.*
import androidx.compose.material3.CardDefaults
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -384,7 +385,11 @@ private fun BattleConfigListItem(
shape = RoundedCornerShape(25),
elevation = CardDefaults.cardElevation(defaultElevation = if (isSelected) 5.dp else 1.dp),
modifier = Modifier
.padding(5.dp)
.padding(5.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Row(
verticalAlignment = Alignment.CenterVertically,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Checkbox
import androidx.compose.material3.ListItem
import androidx.compose.material3.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
Expand Down Expand Up @@ -37,7 +39,11 @@ fun CardPriorityListItem.Render(

Card(
modifier = Modifier
.padding(16.dp)
.padding(16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Row(
verticalAlignment = Alignment.CenterVertically
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -47,7 +48,11 @@ fun FineTuneScreen(
Card(
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(bottom = 16.dp)
.padding(bottom = 16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
it.FineTuneSetter()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Language
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.Icon
Expand Down Expand Up @@ -262,7 +263,11 @@ private fun MainScreenContent(
item {
Card(
modifier = Modifier
.padding(16.dp)
.padding(16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column {
Preference(
Expand Down Expand Up @@ -356,7 +361,11 @@ private fun AccessibilityServiceBlock(
Card(
modifier = Modifier
.padding(horizontal = 16.dp)
.fillMaxWidth()
.fillMaxWidth(),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Fullscreen
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.CardDefaults.cardElevation
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -96,7 +98,11 @@ fun LazyListScope.advancedGroup(
AnimatedVisibility(gameAreaMode == GameAreaMode.Custom) {
Card(
modifier = Modifier.padding(5.dp),
elevation = cardElevation(5.dp)
elevation = cardElevation(5.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column(
modifier = Modifier.scale(0.9f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -54,7 +56,11 @@ private fun MoreOptionsContent(
content = {
Card(
modifier = Modifier
.padding(16.dp)
.padding(16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
LazyColumn(
contentPadding = PaddingValues(bottom = 16.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults.cardColors
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.CardDefaults.cardElevation
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand Down Expand Up @@ -76,7 +76,11 @@ private fun PreferredSupport(
item {
Card(
modifier = Modifier
.padding(16.dp)
.padding(16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column(
modifier = Modifier
Expand Down Expand Up @@ -121,7 +125,11 @@ private fun PreferredSupport(
item {
Card(
modifier = Modifier
.padding(16.dp)
.padding(16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column(
modifier = Modifier
Expand All @@ -148,7 +156,11 @@ private fun PreferredSupport(
item {
Card(
modifier = Modifier
.padding(16.dp)
.padding(16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column {
PreferenceGroupHeader(
Expand Down Expand Up @@ -182,7 +194,11 @@ private fun PreferredSupport(
item {
Card(
modifier = Modifier
.padding(16.dp)
.padding(16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
PreferredSupportHelp()
}
Expand Down Expand Up @@ -240,7 +256,7 @@ private fun MaxSkills(

Card(
elevation = cardElevation(5.dp),
colors = cardColors(
colors = CardDefaults.cardColors(
containerColor = backgroundColor,
contentColor = foregroundColor
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -217,14 +218,22 @@ private fun SpamView(
Column {
Card(
modifier = Modifier
.padding(16.dp)
.padding(16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
NpSpamView(spamConfig = selectedConfig.np)
}

Card(
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(horizontal = 16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Column {
selectedConfig.skills.mapIndexed { index, skillConfig ->
Expand Down

0 comments on commit 8609c8b

Please sign in to comment.