Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor(ui): Optimize card component style and color management #1381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matsuzaka-yuki wants to merge 1 commit into bmax121:main
base: main
Choose a base branch
Loading
from matsuzaka-yuki:main

Conversation

@matsuzaka-yuki
Copy link
Contributor

@matsuzaka-yuki matsuzaka-yuki commented Jan 31, 2026

  • Replace ElevatedCard with Card component to unify card styling
  • Dynamically set card background color and content color based on state to improve readability
  • Use surfaceColorAtElevation to enhance depth and color expression
  • Standardize card corner radius to 20dp to improve visual consistency

- Replace ElevatedCard with Card component to unify card styling
- Dynamically set card background color and content color based on state to improve readability
- Use surfaceColorAtElevation to enhance depth and color expression
- Standardize card corner radius to 20dp to improve visual consistency

else -> {
MaterialTheme.colorScheme.secondaryContainer
MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp) to MaterialTheme.colorScheme.onSurface
Copy link
Contributor

@AlexLiuDev233 AlexLiuDev233 Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you want to do
I think you should read Android's UI design documents first Click There

You can see from this document, card colors use surfaceContainer,
we already have surface surfaceContainerLowest surfaceContainerLow surfaceContainer surfaceContainerHigh surfaceContainerHighest 6 elevation colors in theme, why manually calc that?

I think manually calc elevation colors is unnecessary, and will cause more rendering time, because you are do math calc internally rather than directly using data calculated at application startup!

}

ElevatedCard(
Card(
Copy link
Contributor

@AlexLiuDev233 AlexLiuDev233 Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to notice to you, you no need to switch to Card, because ElevatedCard basically is an alias of Card itself

@Composable
fun ElevatedCard(
 modifier: Modifier = Modifier,
 shape: Shape = CardDefaults.elevatedShape,
 colors: CardColors = CardDefaults.elevatedCardColors(),
 elevation: CardElevation = CardDefaults.elevatedCardElevation(),
 content: @Composable ColumnScope.() -> Unit,
) =
 Card(
 modifier = modifier,
 shape = shape,
 border = null,
 elevation = elevation,
 colors = colors,
 content = content,
 )

This is a code snippet of material3-android library, as you can see, ElevatedCard is an card without border, that is all
You no need change that if you just want change contentColor, and btw, you lost elevation set

And if you want unify, you should package your own Card control, NOT CHANGE EVERYWHERE TO WASTE, THAT IS A NIGHTMARE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@AlexLiuDev233 AlexLiuDev233 AlexLiuDev233 requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /