Skip to content

Commit 64763ef

Browse files
committed
统一安卓设计系统与 Web 移动端视觉令牌
1 parent cce076f commit 64763ef

1 file changed

Lines changed: 38 additions & 24 deletions

File tree

  • android/core/designsystem/src/main/java/com/nowen/video/v2/core/designsystem

android/core/designsystem/src/main/java/com/nowen/video/v2/core/designsystem/DesignSystem.kt

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import coil.compose.AsyncImage
2323
/**
2424
* Android 与 Web 移动端共用的视觉基准。
2525
*
26-
* 这里不再采用 Material 默认蓝色体系,而是直接映射 Nowen Web 的浅色珍珠白、
27-
* 深色 navy、紫色主操作与低对比边框,让 Compose 页面天然继承同一套品牌语言
26+
* 色彩、圆角、排版和内容密度直接映射 Web UI 2.0 的移动端规范,避免 Compose
27+
* 页面继续落回 Material 默认蓝色、大字号和过度圆角的视觉语言
2828
*/
2929
object NowenColors {
3030
val DeepSpace = Color(0xFF070A12)
@@ -41,6 +41,18 @@ object NowenColors {
4141
val LightOutline = Color(0xFFE7E8EF)
4242
}
4343

44+
/** Web 移动端与 Android 共用的几何密度。 */
45+
object NowenMobileMetrics {
46+
val PageHorizontal = 10.dp
47+
val SectionPadding = 14.dp
48+
val SectionRadius = 18.dp
49+
val CardRadius = 10.dp
50+
val CompactCardRadius = 9.dp
51+
val RailGap = 10.dp
52+
val SectionGap = 18.dp
53+
val ControlRadius = 11.dp
54+
}
55+
4456
private val DarkScheme = darkColorScheme(
4557
primary = NowenColors.Lavender,
4658
onPrimary = Color.White,
@@ -74,21 +86,21 @@ private val LightScheme = lightColorScheme(
7486
)
7587

7688
private val Shapes = Shapes(
77-
extraSmall = RoundedCornerShape(8.dp),
78-
small = RoundedCornerShape(12.dp),
79-
medium = RoundedCornerShape(16.dp),
80-
large = RoundedCornerShape(22.dp),
81-
extraLarge = RoundedCornerShape(28.dp),
89+
extraSmall = RoundedCornerShape(6.dp),
90+
small = RoundedCornerShape(9.dp),
91+
medium = RoundedCornerShape(12.dp),
92+
large = RoundedCornerShape(18.dp),
93+
extraLarge = RoundedCornerShape(22.dp),
8294
)
8395

8496
private val Type = Typography(
85-
headlineLarge = TextStyle(fontSize = 30.sp, lineHeight = 36.sp, fontWeight = FontWeight.Bold, letterSpacing = (-0.6).sp),
86-
headlineMedium = TextStyle(fontSize = 25.sp, lineHeight = 31.sp, fontWeight = FontWeight.Bold, letterSpacing = (-0.35).sp),
87-
titleLarge = TextStyle(fontSize = 20.sp, lineHeight = 26.sp, fontWeight = FontWeight.SemiBold),
88-
titleMedium = TextStyle(fontSize = 16.sp, lineHeight = 22.sp, fontWeight = FontWeight.SemiBold),
89-
bodyLarge = TextStyle(fontSize = 16.sp, lineHeight = 25.sp),
90-
bodyMedium = TextStyle(fontSize = 14.sp, lineHeight = 21.sp),
91-
labelLarge = TextStyle(fontSize = 14.sp, lineHeight = 18.sp, fontWeight = FontWeight.SemiBold),
97+
headlineLarge = TextStyle(fontSize = 28.sp, lineHeight = 33.sp, fontWeight = FontWeight.Bold, letterSpacing = (-0.45).sp),
98+
headlineMedium = TextStyle(fontSize = 22.sp, lineHeight = 28.sp, fontWeight = FontWeight.Bold, letterSpacing = (-0.25).sp),
99+
titleLarge = TextStyle(fontSize = 18.sp, lineHeight = 23.sp, fontWeight = FontWeight.SemiBold),
100+
titleMedium = TextStyle(fontSize = 15.sp, lineHeight = 20.sp, fontWeight = FontWeight.SemiBold),
101+
bodyLarge = TextStyle(fontSize = 15.sp, lineHeight = 23.sp),
102+
bodyMedium = TextStyle(fontSize = 13.sp, lineHeight = 20.sp),
103+
labelLarge = TextStyle(fontSize = 13.sp, lineHeight = 17.sp, fontWeight = FontWeight.SemiBold),
92104
)
93105

94106
@Composable
@@ -107,7 +119,7 @@ fun NowenTheme(
107119
@Composable
108120
fun NowenPage(
109121
modifier: Modifier = Modifier,
110-
contentPadding: PaddingValues = PaddingValues(horizontal = 16.dp),
122+
contentPadding: PaddingValues = PaddingValues(horizontal = NowenMobileMetrics.PageHorizontal),
111123
content: @Composable ColumnScope.() -> Unit,
112124
) {
113125
Column(
@@ -153,16 +165,16 @@ fun ElevatedPanel(
153165
) {
154166
Surface(
155167
modifier = modifier,
156-
shape = MaterialTheme.shapes.large,
168+
shape = RoundedCornerShape(NowenMobileMetrics.SectionRadius),
157169
tonalElevation = 0.dp,
158-
shadowElevation = 1.dp,
170+
shadowElevation = 0.dp,
159171
color = MaterialTheme.colorScheme.surface,
160172
border = androidx.compose.foundation.BorderStroke(
161173
1.dp,
162-
MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.9f),
174+
MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.78f),
163175
),
164176
) {
165-
Column(Modifier.padding(16.dp), content = content)
177+
Column(Modifier.padding(NowenMobileMetrics.SectionPadding), content = content)
166178
}
167179
}
168180

@@ -186,12 +198,12 @@ fun MediaPosterCard(
186198
onClick: () -> Unit,
187199
modifier: Modifier = Modifier,
188200
) {
189-
Column(modifier = modifier.width(132.dp).clickable(onClick = onClick)) {
201+
Column(modifier = modifier.width(112.dp).clickable(onClick = onClick)) {
190202
Box(
191203
modifier = Modifier
192204
.fillMaxWidth()
193205
.aspectRatio(2f / 3f)
194-
.clip(MaterialTheme.shapes.medium)
206+
.clip(RoundedCornerShape(NowenMobileMetrics.CompactCardRadius))
195207
.background(MaterialTheme.colorScheme.surfaceVariant),
196208
) {
197209
AsyncImage(
@@ -209,7 +221,7 @@ fun MediaPosterCard(
209221
)
210222
}
211223
}
212-
Spacer(Modifier.height(8.dp))
224+
Spacer(Modifier.height(6.dp))
213225
Text(title, maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.titleMedium)
214226
if (!subtitle.isNullOrBlank()) {
215227
Text(
@@ -236,8 +248,10 @@ fun MessagePanel(
236248
Spacer(Modifier.height(8.dp))
237249
Text(message, color = MaterialTheme.colorScheme.onSurfaceVariant)
238250
if (actionLabel != null && onAction != null) {
239-
Spacer(Modifier.height(16.dp))
240-
FilledTonalButton(onClick = onAction) { Text(actionLabel) }
251+
Spacer(Modifier.height(14.dp))
252+
FilledTonalButton(onClick = onAction, shape = RoundedCornerShape(NowenMobileMetrics.ControlRadius)) {
253+
Text(actionLabel)
254+
}
241255
}
242256
}
243257
}

0 commit comments

Comments
 (0)