feat: 新增设计系统(颜色/字体/浅色主题)
This commit is contained in:
@@ -12,6 +12,7 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.placeholder.ringhealth.core.designsystem.RingHealthTheme
|
||||
|
||||
/** 唯一 Activity,承载 Compose 界面。 */
|
||||
class MainActivity : ComponentActivity() {
|
||||
@@ -19,8 +20,11 @@ class MainActivity : ComponentActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContent {
|
||||
MaterialTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize()) {
|
||||
RingHealthTheme {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
) {
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
// 文案取自 res/values/strings.xml,不在 Kotlin 里硬编码用户可见文字
|
||||
Text(stringResource(R.string.app_name))
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.placeholder.ringhealth.core.designsystem
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
/** 品牌主色(健康绿,仿小米运动健康首页大环)。 */
|
||||
val BrandGreen = Color(0xFF34C759)
|
||||
val BrandGreenDark = Color(0xFF248A3D)
|
||||
|
||||
/** 页面与卡片背景。 */
|
||||
val AppBackground = Color(0xFFF5F6F8)
|
||||
val CardSurface = Color(0xFFFFFFFF)
|
||||
val TextPrimary = Color(0xFF1C1C1E)
|
||||
val TextSecondary = Color(0xFF8E8E93)
|
||||
val DividerColor = Color(0xFFEFEFF4)
|
||||
|
||||
/** 各健康指标的语义色,全应用统一引用。 */
|
||||
val MetricGreen = Color(0xFF34C759) // 步数
|
||||
val MetricRed = Color(0xFFFF3B30) // 心率
|
||||
val MetricBlue = Color(0xFF3B5BFF) // 睡眠
|
||||
val MetricCyan = Color(0xFF00C7BE) // 血氧
|
||||
val MetricPurple = Color(0xFFAF52DE) // 压力
|
||||
val MetricOrange = Color(0xFFFF9500) // 体温
|
||||
val MetricYellow = Color(0xFFFFCC00) // 血压 / 提醒
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.placeholder.ringhealth.core.designsystem
|
||||
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
private val RingHealthColors = lightColorScheme(
|
||||
primary = BrandGreen,
|
||||
onPrimary = androidx.compose.ui.graphics.Color.White,
|
||||
secondary = BrandGreenDark,
|
||||
background = AppBackground,
|
||||
onBackground = TextPrimary,
|
||||
surface = CardSurface,
|
||||
onSurface = TextPrimary,
|
||||
surfaceVariant = DividerColor,
|
||||
)
|
||||
|
||||
/**
|
||||
* 应用主题。阶段一仅提供浅色模式(深色留到 M5)。
|
||||
*/
|
||||
@Composable
|
||||
fun RingHealthTheme(content: @Composable () -> Unit) {
|
||||
MaterialTheme(
|
||||
colorScheme = RingHealthColors,
|
||||
typography = RingHealthTypography,
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.placeholder.ringhealth.core.designsystem
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
/** 大号数值样式:首页大环与详情页主数字。 */
|
||||
val MetricValueStyle = TextStyle(
|
||||
fontSize = 40.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = TextPrimary,
|
||||
)
|
||||
|
||||
/** 中等数值样式:指标卡主数字。 */
|
||||
val MetricTileValueStyle = TextStyle(
|
||||
fontSize = 22.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
color = TextPrimary,
|
||||
)
|
||||
|
||||
/** 全局字体排版。 */
|
||||
val RingHealthTypography = Typography()
|
||||
Reference in New Issue
Block a user