Install
openclaw skills install @yhongm/material-design-skillGoogle Material Design 3 (M3) 跨平台设计系统技能。覆盖色彩系统、Typography、Shape、 Elevation、Icons、Animation、组件规范(Buttons、Cards、Navigation 等)及 Flutter/Compose/Android/Web 四平台实现。当用户提到 Material Design、MD3、M3、 Material You、动态配色、Material Icon、设计系统、Android UI、Flutter Material 时触发。
openclaw skills install @yhongm/material-design-skillM3 定义了 26+ 色彩角色,分为五大类:
| 类别 | 角色 | 说明 |
|---|---|---|
| Primary | Primary, Primary Container, On Primary, On Primary Container | 主品牌色 |
| Secondary | Secondary, Secondary Container, On Secondary, On Secondary Container | 辅助色 |
| Tertiary | Tertiary, Tertiary Container, On Tertiary, On Tertiary Container | 强调色 |
| Error | Error, Error Container, On Error, On Error Container | 错误/警告 |
| Neutral | Surface, On Surface, Surface Variant, Outline, Outline Variant | 中性色 |
| Neutral Special | Inverse Surface, Inverse On Surface, Inverse Primary, Surface Tint | 特殊中性 |
| Scrim | Scrim | 遮罩层 |
用户可通过壁纸生成主题色(User-generated color scheme):
ColorScheme.fromSeed(seedColor: color, brightness: Brightness.light)dynamicColor = DynamicColor.getOrCreate(context)| 平台 | 代码 |
|---|---|
| Flutter | ColorScheme.fromSeed(seedColor: Colors.blue, brightness: Brightness.light) |
| Compose | lightColorScheme(primary = ...) |
| Android XML | Theme.Material3.DayNight.NoActionBar |
| CSS | --md-sys-color-primary: #...; |
详细参考:color-system.md
| 角色 | 大(Large) | 中(Medium) | 小(Small) |
|---|---|---|---|
| Display | Display Large (57sp) | Display Medium (45sp) | Display Small (36sp) |
| Headline | Headline Large (32sp) | Headline Medium (28sp) | Headline Small (24sp) |
| Title | Title Large (22sp) | Title Medium (16sp) | Title Small (14sp) |
| Body | Body Large (16sp) | Body Medium (14sp) | Body Small (12sp) |
| Label | Label Large (14sp) | Label Medium (12sp) | Label Small (11sp) |
| 平台 | API |
|---|---|
| Flutter | TextTheme(displayLarge: TextStyle(...), ...) |
| Compose | Typography(displayLarge: TextStyle(...), ...) |
| Android | TextAppearance.Material3.DisplayLarge |
| CSS | font-size: 57px; font-weight: 400; |
详细参考:typography.md
35 种形状,corner radius 分为 10 级:
| 级别 | Small | Medium | Large |
|---|---|---|---|
| 0 | 0dp | 0dp | 0dp |
| 1 | 2dp | 4dp | 0dp |
| 2 | 4dp | 8dp | 0dp |
| 3 | 6dp | 12dp | 0dp |
| 4 | 8dp | 16dp | 0dp |
| 5 | 12dp | 20dp | 0dp |
M3 Expressive 新增:Large Increased (20dp)、Extra Large Increased (32dp)、Extra Extra Large (48dp)
6 级(Level 0-5),通过 tonal surface color 或 shadow 显示高度:
| Level | 用途 | 叠加高度 |
|---|---|---|
| 0 | 平面 | 0dp |
| 1 | 表面 | 1dp |
| 2 | 导航 | 3dp |
| 3 | FAB | 6dp |
| 4 | 模态 | 8dp |
| 5 | 导航 + FAB | 12dp |
Material Symbols variable font,支持 4 个可变轴:
样式:Outlined、Rounded、Sharp
| 方案 | 特点 | 适用场景 |
|---|---|---|
| Expressive | overshoot(弹性超出) | 英雄时刻、关键交互 |
| Standard | ease into(缓入到达) | 功能性产品 |
三个参数控制弹簧动画:
| 参数 | 说明 | 典型值 |
|---|---|---|
| Stiffness | 刚度,越高越快 | 100-1000 |
| Damping | 阻尼,越高越少弹跳 | 10-30 |
| Mass | 质量,越低响应越快 | 0.5-2 |
| 模式 | 说明 | 平台可用性 |
|---|---|---|
| Container Transform | 共享元素变换 | Flutter 需自定义实现(Hero + flightShuttleBuilder) |
| Fade Through | 淡入淡出 | 全平台 |
| Shared Axis | 共享轴位移 | 全平台 |
注意:Flutter 有物理弹簧动画(SpringSimulation)和 Hero/Staggered 动画,可实现类似 Expressive 效果,但官方 M3 Motion 库封装暂不可用。
详细参考:motion.md
Window Size Classes:
| Class | 宽度 | 布局 |
|---|---|---|
| Compact | < 600dp | 单列 |
| Medium | 600-840dp | 自适应列 |
| Expanded | > 840dp | 多列+侧边导航 |
详细参考:foundations.md
| 类别 | 组件 | 平台可用性 |
|---|---|---|
| Buttons | Buttons, FABs, Icon buttons, Button groups | Flutter ✅ Compose ✅ Android ✅ Web ✅ |
| Date & Time | Date pickers, Time pickers | Flutter ✅ Compose ✅ Android ✅ Web ❌ |
| Loading | Loading indicators, Progress indicators | Flutter ✅ Compose ✅ Android ✅ Web ❌ |
| Navigation | Navigation bar, Navigation rail, Navigation drawer | Flutter ✅ Compose ✅ Android ✅ Web ❌ |
| Sheets | Bottom sheets, Side sheets | Flutter ✅ Compose ✅ Android ✅ Web ❌ |
| Selection | Checkboxes, Chips, Radio buttons, Switches | Flutter ✅ Compose ✅ Android ✅ Web ✅ |
| Text Input | Text fields | Flutter ✅ Compose ✅ Android ✅ Web ✅ |
| Containment | App bars, Cards, Dialogs, Lists | Flutter ✅ Compose ✅ Android ✅ Web ✅ |
详细参考:
MaterialApp(
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
),
);
Flutter 有物理弹簧动画(SpringSimulation)和 Hero/Staggered 动画,可部分实现 Expressive 效果,但官方 M3 Motion 库封装暂不可用。
MaterialTheme(
colorScheme = lightColorScheme(
primary = Color(0xFF6750A4),
// ...
)
) { /* content */ }
Compose 支持完整的 M3 Expressive。
<style name="Theme.MyApp" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/...</item>
</style>
Material Web Components 处于维护模式,不再开发新功能。
详细参考:platform-implementation.md
来源:Google Material Design 3 官方文档 URL: https://m3.material.io/ 版本:M3 Expressive(2025 年 5 月更新) 更新日期:2026-04-24
Material Design 3(MD3/M3)是 Google 发布的最新设计系统,通过 Material You(动态配色)实现跨平台一致的视觉体验。支持 Flutter、Jetpack Compose、Android View、Web 四平台。
| 原则 | 说明 | 应用场景 |
|---|---|---|
| Material Expressive | 表达品牌个性,通过颜色、形状、动画体现 | 自定义主题色、圆角半径 |
| Responsive | 适配不同屏幕尺寸和输入方式 | 断点布局、触摸/鼠标适配 |
| Accessible | 为所有用户设计,包含视觉/运动/认知障碍 | 对比度要求、最小触摸区域 |
| M3 Expressive 是 M3 的重大升级,引入了更丰富的动画系统、物理弹簧动效和组件变体。以下组件已在 M3 Expressive(May 2025)中被标记为不再推荐: |
📌 色彩系统完整内容见上方 #色彩系统 章节。
详细参考:color-system.md
| 角色 | 大(Large) | 中(Medium) | 小(Small) |
|---|---|---|---|
| Display | Display Large (57sp) | Display Medium (45sp) | Display Small (36sp) |
| Headline | Headline Large (32sp) | Headline Medium (28sp) | Headline Small (24sp) |
| Title | Title Large (22sp) | Title Medium (16sp) | Title Small (14sp) |
| Body | Body Large (16sp) | Body Medium (14sp) | Body Small (12sp) |
| Label | Label Large (14sp) | Label Medium (12sp) | Label Small (11sp) |
| 平台 | API |
|---|---|
| Flutter | TextTheme(displayLarge: TextStyle(...), ...) |
| Compose | Typography(displayLarge: TextStyle(...), ...) |
| Android | TextAppearance.Material3.DisplayLarge |
| CSS | font-size: 57px; font-weight: 400; |
详细参考:typography.md
35 种形状,corner radius 分为 10 级:
| 级别 | Small | Medium | Large |
|---|---|---|---|
| 0 | 0dp | 0dp | 0dp |
| 1 | 2dp | 4dp | 0dp |
| 2 | 4dp | 8dp | 0dp |
| 3 | 6dp | 12dp | 0dp |
| 4 | 8dp | 16dp | 0dp |
| 5 | 12dp | 20dp | 0dp |
M3 Expressive 新增:Large Increased (20dp)、Extra Large Increased (32dp)、Extra Extra Large (48dp)
6 级(Level 0-5),通过 tonal surface color 或 shadow 显示高度:
| Level | 用途 | 叠加高度 |
|---|---|---|
| 0 | 平面 | 0dp |
| 1 | 表面 | 1dp |
| 2 | 导航 | 3dp |
| 3 | FAB | 6dp |
| 4 | 模态 | 8dp |
| 5 | 导航 + FAB | 12dp |
Material Symbols variable font,支持 4 个可变轴:
样式:Outlined、Rounded、Sharp
| 方案 | 特点 | 适用场景 |
|---|---|---|
| Expressive | overshoot(弹性超出) | 英雄时刻、关键交互 |
| Standard | ease into(缓入到达) | 功能性产品 |
三个参数控制弹簧动画:
| 参数 | 说明 | 典型值 |
|---|---|---|
| Stiffness | 刚度,越高越快 | 100-1000 |
| Damping | 阻尼,越高越少弹跳 | 10-30 |
| Mass | 质量,越低响应越快 | 0.5-2 |
| 模式 | 说明 | 平台可用性 |
|---|---|---|
| Container Transform | 共享元素变换 | Flutter 需自定义实现(Hero + flightShuttleBuilder) |
| Fade Through | 淡入淡出 | 全平台 |
| Shared Axis | 共享轴位移 | 全平台 |
注意:Flutter 有物理弹簧动画(SpringSimulation)和 Hero/Staggered 动画,可实现类似 Expressive 效果,但官方 M3 Motion 库封装暂不可用。
详细参考:motion.md
Window Size Classes:
| Class | 宽度 | 布局 |
|---|---|---|
| Compact | < 600dp | 单列 |
| Medium | 600-840dp | 自适应列 |
| Expanded | > 840dp | 多列+侧边导航 |
详细参考:foundations.md
| 类别 | 组件 | 平台可用性 |
|---|---|---|
| Buttons | Buttons, FABs, Icon buttons, Button groups | Flutter ✅ Compose ✅ Android ✅ Web ✅ |
| Date & Time | Date pickers, Time pickers | Flutter ✅ Compose ✅ Android ✅ Web ❌ |
| Loading | Loading indicators, Progress indicators | Flutter ✅ Compose ✅ Android ✅ Web ❌ |
| Navigation | Navigation bar, Navigation rail, Navigation drawer | Flutter ✅ Compose ✅ Android ✅ Web ❌ |
| Sheets | Bottom sheets, Side sheets | Flutter ✅ Compose ✅ Android ✅ Web ❌ |
| Selection | Checkboxes, Chips, Radio buttons, Switches | Flutter ✅ Compose ✅ Android ✅ Web ✅ |
| Text Input | Text fields | Flutter ✅ Compose ✅ Android ✅ Web ✅ |
| Containment | App bars, Cards, Dialogs, Lists | Flutter ✅ Compose ✅ Android ✅ Web ✅ |
详细参考:
MaterialApp(
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
),
);
Flutter 有物理弹簧动画(SpringSimulation)和 Hero/Staggered 动画,可部分实现 Expressive 效果,但官方 M3 Motion 库封装暂不可用。
MaterialTheme(
colorScheme = lightColorScheme(
primary = Color(0xFF6750A4),
// ...
)
) { /* content */ }
Compose 支持完整的 M3 Expressive。
<style name="Theme.MyApp" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/...</item>
</style>
Material Web Components 处于维护模式,不再开发新功能。
详细参考:platform-implementation.md
| 平台 | M3 Expressive 支持 |
|---|---|
| Jetpack Compose | ✅ 完整支持 |
| Android View | ✅ 完整支持 |
| Flutter | ⚠️ 官方库不可用,可通过 Hero/Staggered/SpringSimulation 自定义实现 |
| Web | ❌ 不可用 |
以下组件在 M3 Expressive(May 2025)中不再推荐:
Flutter 3.22+ 引入了 Platform.adaptive 系列组件,自动在 iOS(Cupertino)和 Android(Material)间切换:
| 组件 | 说明 | 自动适配 |
|---|---|---|
PlatformNavigationBar | 底部导航栏 | iOS → CupertinoTabBar / Android → NavigationBar |
PlatformIconButton | 图标按钮 | iOS → CupertinoButton / Android → IconButton |
PlatformTextButton | 文字按钮 | iOS → CupertinoButton / Android → TextButton |
PlatformSwitch | 开关 | iOS → CupertinoSwitch / Android → Switch |
// 最常用的 PlatformNavigationBar
PlatformNavigationBar(
selectedIndex: currentIndex,
onDestinationSelected: (i) => setState(() => currentIndex = i),
destinations: const [
NavigationDestination(
icon: Icon(Icons.explore_outlined),
selectedIcon: Icon(Icons.explore),
label: 'Explore',
),
NavigationDestination(
icon: Icon(Icons.bookmark_border),
selectedIcon: Icon(Icons.bookmark),
label: 'Saved',
),
],
)
// PlatformIconButton 示例
PlatformIconButton(
icon: Icon(Icons.settings),
onPressed: () => openSettings(),
)
| Token | 说明 |
|---|---|
primary | 主品牌色 |
onPrimary | 主色上的文字色 |
primaryContainer | 主色容器 |
surface | 表面色 |
surfaceVariant | 表面变体 |
outline | 边框色 |
error | 错误色 |
| 角色-尺寸 | 字重 | 大小 |
|---|---|---|
| Display Large | 400 | 57sp |
| Headline Medium | 400 | 28sp |
| Title Medium | 500 | 16sp |
| Body Large | 400 | 16sp |
| Label Small | 500 | 11sp |
| 级别 | 值 |
|---|---|
| Small | 4-8dp |
| Medium | 8-16dp |
| Large | 12-20dp |
| Extra Large | 32dp+ |
| Level | 叠加高度 | 典型用途 |
|---|---|---|
| 0 | 0dp | 平面 |
| 1 | 1dp | 表面 |
| 3 | 6dp | FAB |
| 5 | 12dp | 模态 |
| 元素 | 最小尺寸 |
|---|---|
| 触摸目标 | 48dp × 48dp |
| 按钮内图标 | 24dp |
| List item | 48dp 高 |
| 功能 | Flutter | Compose | Android | Web |
|---|---|---|---|---|
| M3 基础 | ✅ | ✅ | ✅ | ✅ |
| M3 Expressive | ❌ | ✅ | ✅ | ❌ |
| 动态配色 | ✅ | ✅ | ✅ 12+ | ❌ |
| 物理弹簧动效 | ❌ | ✅ | ✅ | ❌ |
| Web Components | N/A | N/A | N/A | ✅ 维护中 |
M3 的动态配色通过
ColorScheme.fromSeed()实现。Flutter 中只需传入一个种子色,系统会自动生成完整的 26 色色板,支持亮色/暗色自动切换。 M3 Expressive 更新后,Compose 已支持物理弹簧动效,但 Flutter 仍不原生支持。
// Flutter 动态配色
MaterialApp(
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
),
);
文档版本:Material Design 3 M3 Expressive(2025 年 5月更新) URL: https://m3.material.io/ 抓取时间:2026-04-24 官方文档涵盖:Color, Typography, Shape, Elevation, Icons, Motion, Foundations, Components, Develop
| 文件 | 行数 | 覆盖内容 |
|---|---|---|
| color-system.md | 427 | 色彩系统完整参考 |
| typography.md | 316 | Typography 完整参考 |
| shape-elevation-icons.md | 213 | Shape、Elevation、Icons |
| motion.md | 507 | 动效系统完整参考 |
| foundations.md | 231 | 设计原则与自适应布局 |
| components-overview.md | 210 | 组件库总览 |
| navigation-components.md | 137 | 导航组件详解 |
| input-components.md | 252 | 输入组件详解 |
| display-components.md | 221 | 展示组件详解 |
| platform-implementation.md | 573 | 跨平台实现 |
| color-scheme-roles.md | 293 | 色彩角色详解 |
| components.md | 517 | 组件完整参考 |
| components-quickref.md | 462 | 组件速查 |
| m3-migration-guide.md | 520 | M2→M3 迁移指南 |
| md3-api-changes.md | 379 | API 变更 |
| motion-animation.md | 448 | 动效动画 |
| layout-constraints.md | 103 | 布局约束 |