mobile-design
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMobile Design
移动设计
Overview
概述
Design and build mobile applications that feel native on each platform. This skill covers React Native, Flutter, and SwiftUI with deep knowledge of platform-specific Human Interface Guidelines (Apple HIG) and Material Design, gesture handling, responsive layouts, offline-first patterns, and app store submission requirements.
设计并构建在各平台上都具备原生体验的移动应用。本技能涵盖React Native、Flutter和SwiftUI相关内容,深度掌握平台专属的人机界面指南(Apple HIG)和Material Design、手势处理、响应式布局、离线优先模式,以及应用商店提交要求。
Phase 1: Platform Analysis
阶段1:平台分析
- Identify target platforms (iOS, Android, both)
- Choose framework (React Native, Flutter, SwiftUI, or cross-platform)
- Review platform-specific design guidelines
- Define navigation architecture
- Map offline requirements
STOP — Present platform and framework recommendation with rationale before design.
- 确定目标平台(iOS、Android、双平台)
- 选择开发框架(React Native、Flutter、SwiftUI或跨平台方案)
- 查阅平台专属设计规范
- 定义导航架构
- 梳理离线功能需求
停止操作——在开展设计前,先给出平台和框架选择建议及理由。
Framework Selection Decision Table
框架选择决策表
| Requirement | React Native | Flutter | SwiftUI | Kotlin/Compose |
|---|---|---|---|---|
| iOS only | Possible | Possible | Best | No |
| Android only | Possible | Possible | No | Best |
| Cross-platform | Good | Best | No | No |
| Native performance critical | OK | Good | Best | Best |
| Existing React web team | Best | Learning curve | Learning curve | Learning curve |
| Complex animations | Good | Best | Good | Good |
| Rapid prototyping | Good | Good | Best (iOS) | OK |
| Large existing codebase (JS) | Best | Rewrite | Rewrite | Rewrite |
| 需求 | React Native | Flutter | SwiftUI | Kotlin/Compose |
|---|---|---|---|---|
| 仅iOS | 可选 | 可选 | 最优 | 不适用 |
| 仅Android | 可选 | 可选 | 不适用 | 最优 |
| 跨平台 | 良好 | 最优 | 不适用 | 不适用 |
| 原生性能要求极高 | 尚可 | 良好 | 最优 | 最优 |
| 现有团队为React Web开发团队 | 最优 | 存在学习成本 | 存在学习成本 | 存在学习成本 |
| 复杂动画需求 | 良好 | 最优 | 良好 | 良好 |
| 快速原型开发 | 良好 | 良好 | 最优(iOS端) | 尚可 |
| 现有大量JS代码库 | 最优 | 需要重写 | 需要重写 | 需要重写 |
Phase 2: Design Implementation
阶段2:设计实现
- Build component library with platform variants
- Implement navigation (tab bar, stack, drawer)
- Handle safe areas and notches
- Add gesture recognizers
- Implement responsive layouts for phone/tablet
STOP — Present navigation architecture and component inventory for review.
- 构建包含平台变体的组件库
- 实现导航功能(标签栏、堆栈、侧边抽屉)
- 适配安全区域和刘海屏
- 添加手势识别器
- 实现适配手机/平板的响应式布局
停止操作——提交导航架构和组件清单供审核。
Platform-Specific HIG Compliance
平台专属HIG合规
Apple Human Interface Guidelines
Apple人机界面指南
| Area | Guideline |
|---|---|
| Navigation | UINavigationController (push/pop), tab bars at bottom (max 5) |
| Typography | SF Pro / SF Pro Rounded, support Dynamic Type (all 11 sizes) |
| Safe Areas | Respect |
| Gestures | Swipe-back for navigation, long press for context menus |
| Haptics | UIFeedbackGenerator (impact, selection, notification) |
| Colors | Semantic system colors ( |
| Modals | Sheets ( |
| Lists | Grouped inset for settings, plain for content feeds |
| Icons | SF Symbols library (5000+ icons, variable weight/size) |
| 领域 | 规范 |
|---|---|
| 导航 | UINavigationController(push/pop),底部标签栏最多5个 |
| 排版 | SF Pro / SF Pro Rounded,支持动态字体(全11种尺寸) |
| 安全区域 | 遵循 |
| 手势 | 侧滑返回导航,长按唤出上下文菜单 |
| 触觉反馈 | UIFeedbackGenerator(震动、选择、通知三类反馈) |
| 颜色 | 语义化系统颜色( |
| 模态框 | 底部弹窗( |
| 列表 | 设置页使用分组内嵌样式,内容流使用普通样式 |
| 图标 | SF Symbols图标库(5000+图标,支持可变字重/尺寸) |
Material Design (Android)
Material Design(Android)
| Area | Guideline |
|---|---|
| Navigation | Bottom navigation bar, navigation drawer, top app bar |
| Typography | Roboto / product font, Material type scale |
| Edge-to-edge | Draw behind system bars, handle window insets |
| Gestures | Predictive back gesture (Android 14+), swipe-to-dismiss |
| Haptics | HapticFeedbackConstants (click, long press, keyboard) |
| Colors | Material You dynamic color from wallpaper, tonal palettes |
| Components | FAB, snackbar, bottom sheet, chips |
| Motion | Shared element transitions, container transform |
| 领域 | 规范 |
|---|---|
| 导航 | 底部导航栏、侧边导航抽屉、顶部应用栏 |
| 排版 | Roboto/产品定制字体,Material字体层级体系 |
| 边到边设计 | 内容可延伸至系统栏下方,处理窗口 insets |
| 手势 | 预测性返回手势(Android 14+),滑动关闭 |
| 触觉反馈 | HapticFeedbackConstants(点击、长按、键盘输入反馈) |
| 颜色 | 基于壁纸的Material You动态颜色、色调调色板 |
| 组件 | 悬浮操作按钮(FAB)、snackbar提示、底部弹窗、标签(chips) |
| 动效 | 共享元素转场、容器形变动效 |
Cross-Platform Pattern Decision Table
跨平台模式决策表
| Feature | iOS Pattern | Android Pattern |
|---|---|---|
| Back navigation | Swipe from left edge | System back button |
| Primary action | Right nav bar button | FAB |
| Alerts | UIAlertController | MaterialAlertDialog |
| Loading | UIActivityIndicator | CircularProgressIndicator |
| Segmented | UISegmentedControl | Tabs / Chips |
| Date picker | Wheel picker | Calendar picker |
| Pull to refresh | Native support | SwipeRefreshLayout |
| Context menu | Long press + haptic | Long press + popup |
| 功能 | iOS模式 | Android模式 |
|---|---|---|
| 返回导航 | 左边缘侧滑 | 系统返回键 |
| 主要操作 | 导航栏右侧按钮 | 悬浮操作按钮(FAB) |
| 警告弹窗 | UIAlertController | MaterialAlertDialog |
| 加载状态 | UIActivityIndicator | CircularProgressIndicator |
| 分段选择 | UISegmentedControl | 标签页/标签(Chips) |
| 日期选择器 | 滚轮选择器 | 日历选择器 |
| 下拉刷新 | 原生支持 | SwipeRefreshLayout |
| 上下文菜单 | 长按+触觉反馈 | 长按+弹出菜单 |
Safe Area Handling
安全区域适配
React Native
React Native
jsx
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
function Screen() {
const insets = useSafeAreaInsets();
return (
<View style={{ flex: 1, paddingTop: insets.top, paddingBottom: insets.bottom }}>
{/* Content */}
</View>
);
}jsx
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
function Screen() {
const insets = useSafeAreaInsets();
return (
<View style={{ flex: 1, paddingTop: insets.top, paddingBottom: insets.bottom }}>
{/* Content */}
</View>
);
}Flutter
Flutter
dart
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: // Content
),
);
}dart
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: // Content
),
);
}SwiftUI
SwiftUI
swift
var body: some View {
VStack {
// Content automatically respects safe areas
}
.ignoresSafeArea(.keyboard) // Only ignore keyboard if needed
}swift
var body: some View {
VStack {
// Content automatically respects safe areas
}
.ignoresSafeArea(.keyboard) // Only ignore keyboard if needed
}Gesture Navigation Patterns
手势导航模式
| Gesture | Usage | Min Target |
|---|---|---|
| Tap | Primary action | 44x44pt |
| Long press | Context menu / secondary action | 44x44pt |
| Swipe horizontal | Navigation, dismiss, reveal actions | Full row |
| Swipe vertical | Scroll, pull-to-refresh, dismiss sheet | Full area |
| Pinch | Zoom images/maps | Content area |
| Pan/Drag | Reorder, move elements | Drag handle |
| 手势 | 用途 | 最小目标区域 |
|---|---|---|
| 点击 | 主要操作 | 44x44pt |
| 长按 | 上下文菜单/次要操作 | 44x44pt |
| 横向滑动 | 导航、关闭、显示操作选项 | 整行区域 |
| 纵向滑动 | 滚动、下拉刷新、关闭弹窗 | 全屏区域 |
| 捏合 | 图片/地图缩放 | 内容区域 |
| 平移/拖拽 | 重排序、移动元素 | 拖拽把手区域 |
Touch Target Rules
触控目标规则
| Rule | Value |
|---|---|
| Minimum size (iOS) | 44x44pt |
| Minimum size (Android) | 48x48dp |
| Minimum spacing | 8pt between targets |
| Visual vs touch | Visual can be smaller; use padding for touch area |
| Primary actions | Bottom 1/3 of screen (thumb zone) |
| 规则 | 数值 |
|---|---|
| 最小尺寸(iOS) | 44x44pt |
| 最小尺寸(Android) | 48x48dp |
| 最小间距 | 触控目标之间间隔8pt |
| 视觉尺寸与触控尺寸 | 视觉元素可以更小,通过padding拓展触控区域 |
| 主要操作位置 | 屏幕下方1/3区域(拇指易操作区) |
Phase 3: Platform Polish
阶段3:平台体验优化
- Platform-specific animations and transitions
- Haptic feedback integration
- App icon and launch screen
- Dark mode and Dynamic Type support
- App store metadata and screenshots
STOP — Test on physical devices before declaring complete.
- 平台专属动画与转场效果
- 触觉反馈集成
- 应用图标和启动页设计
- 深色模式和动态字体支持
- 应用商店元数据和截图准备
停止操作——在宣布完成前,在物理设备上进行测试。
Responsive Layout Decision Table
响应式布局决策表
| Form Factor | Layout | Navigation |
|---|---|---|
| Phone Portrait | Single column | Bottom tabs |
| Phone Landscape | Single column or split | Side tabs |
| Tablet Portrait | Two columns | Sidebar |
| Tablet Landscape | Three columns | Persistent sidebar |
| 设备形态 | 布局 | 导航 |
|---|---|---|
| 手机竖屏 | 单列 | 底部标签栏 |
| 手机横屏 | 单列或双列 | 侧边标签栏 |
| 平板竖屏 | 双列 | 侧边栏 |
| 平板横屏 | 三列 | 常驻侧边栏 |
React Native Responsive
React Native 响应式实现
javascript
import { useWindowDimensions } from 'react-native';
function useResponsive() {
const { width } = useWindowDimensions();
return {
isPhone: width < 768,
isTablet: width >= 768 && width < 1024,
isDesktop: width >= 1024,
columns: width < 768 ? 1 : width < 1024 ? 2 : 3,
};
}javascript
import { useWindowDimensions } from 'react-native';
function useResponsive() {
const { width } = useWindowDimensions();
return {
isPhone: width < 768,
isTablet: width >= 768 && width < 1024,
isDesktop: width >= 1024,
columns: width < 768 ? 1 : width < 1024 ? 2 : 3,
};
}Flutter Responsive
Flutter 响应式实现
dart
class ResponsiveLayout extends StatelessWidget {
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 600) return MobileLayout();
if (constraints.maxWidth < 1200) return TabletLayout();
return DesktopLayout();
},
);
}
}dart
class ResponsiveLayout extends StatelessWidget {
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 600) return MobileLayout();
if (constraints.maxWidth < 1200) return TabletLayout();
return DesktopLayout();
},
);
}
}Offline-First Architecture
离线优先架构
| Layer | Pattern | Implementation |
|---|---|---|
| Data | Local-first | SQLite/Realm as primary store, server as sync target |
| Updates | Optimistic | Apply locally, sync in background |
| Conflicts | Resolution strategy | Last-write-wins or field-level merge |
| Queue | Persistent ops | Store pending operations, retry on connectivity |
| Cache | Stale-while-revalidate | Serve cached, refresh in background |
| 层级 | 模式 | 实现方案 |
|---|---|---|
| 数据层 | 本地优先 | SQLite/Realm作为主存储,服务端作为同步目标 |
| 更新层 | 乐观更新 | 本地先生效,后台异步同步 |
| 冲突处理 | 解决策略 | 最后写入优先或字段级合并 |
| 队列层 | 持久化操作 | 存储待执行操作,网络恢复后重试 |
| 缓存层 | 缓存优先同时后台刷新 | 优先返回缓存内容,后台异步刷新数据 |
Implementation Checklist
实现检查清单
- Network status detection and UI indicator
- Local database for all critical data
- Operation queue for pending writes
- Retry logic with exponential backoff
- Conflict detection and resolution strategy
- Cache invalidation policy
- Sync status indicator in UI
- Graceful degradation for network-only features
- 网络状态检测及UI提示
- 所有关键数据存储在本地数据库
- 待写入操作队列
- 带指数退避的重试逻辑
- 冲突检测与解决策略
- 缓存失效策略
- UI层同步状态提示
- 仅网络可用功能的优雅降级
App Store Guidelines Summary
应用商店规范汇总
| Requirement | Apple App Store | Google Play Store |
|---|---|---|
| Screenshots | 6.7" and 5.5" required, 12.9" iPad | Min 2, max 8 per device |
| App icon | 1024x1024px, no alpha, no corners | 512x512px, adaptive recommended |
| Privacy | Nutrition labels required | Data safety section required |
| Review time | 24-48 hours typical | Hours to days |
| Common rejections | Crashes, placeholder content | Policy violations, crashes |
| 要求 | 苹果应用商店 | 谷歌应用商店 |
|---|---|---|
| 截图 | 要求提供6.7英寸和5.5英寸机型截图,iPad需提供12.9英寸截图 | 单设备最少2张,最多8张 |
| 应用图标 | 1024x1024px,无alpha通道,无圆角 | 512x512px,推荐使用自适应图标 |
| 隐私要求 | 必须提供隐私营养标签 | 必须填写数据安全板块 |
| 审核时长 | 通常24-48小时 | 数小时到数天不等 |
| 常见驳回原因 | 崩溃、占位内容 | 政策违规、崩溃 |
Performance Targets
性能指标目标
| Metric | Target |
|---|---|
| Cold start | < 2 seconds |
| Screen transition | < 300ms |
| Touch response | < 100ms |
| Scroll FPS | 60fps (no drops) |
| Memory usage | < 200MB baseline |
| App size | < 50MB download |
| 指标 | 目标值 |
|---|---|
| 冷启动 | 小于2秒 |
| 页面转场 | 小于300ms |
| 触控响应 | 小于100ms |
| 滚动帧率 | 60fps(无掉帧) |
| 内存占用 | 基线小于200MB |
| 应用大小 | 下载包小于50MB |
Anti-Patterns / Common Mistakes
反模式/常见错误
| Anti-Pattern | Why It Is Wrong | What to Do Instead |
|---|---|---|
| Web patterns in mobile (hover states) | No hover on touch devices | Use press/tap states |
| Tiny touch targets (< 44pt) | Frustrating, accessibility fail | Minimum 44x44pt touch area |
| iOS-styled buttons on Android | Feels foreign, confuses users | Use platform-native components |
| Fixed layouts for one screen size | Breaks on tablets and foldables | Responsive layouts with breakpoints |
| Blocking main thread with I/O | UI freezes, ANR dialogs | Async I/O, background threads |
| Not handling keyboard appearance | Content hidden behind keyboard | Adjust layout on keyboard show |
| Assuming constant connectivity | App crashes or hangs offline | Offline-first architecture |
| Pixel values instead of dp/pt | Different sizes on different screens | Use density-independent units |
| Skipping haptic feedback | App feels cheap and unresponsive | Add haptics for key interactions |
| 反模式 | 错误原因 | 优化方案 |
|---|---|---|
| 在移动端使用Web模式(比如hover状态) | 触控设备没有hover交互 | 使用按压/点击状态 |
| 触控目标过小(小于44pt) | 操作体验差,不符合无障碍要求 | 保证最小44x44pt的触控区域 |
| 在Android上使用iOS风格的按钮 | 体验违和,容易误导用户 | 使用平台原生组件 |
| 仅适配单一屏幕尺寸的固定布局 | 在平板和折叠屏设备上布局错乱 | 使用带断点的响应式布局 |
| I/O操作阻塞主线程 | UI卡顿,出现应用无响应弹窗 | 使用异步I/O、后台线程处理 |
| 未处理键盘弹出场景 | 内容被键盘遮挡 | 键盘弹出时调整布局 |
| 默认网络始终可用 | 离线时应用崩溃或卡死 | 采用离线优先架构 |
| 使用像素值而非dp/pt单位 | 在不同屏幕上显示尺寸不一致 | 使用密度无关单位 |
| 忽略触觉反馈 | 应用体验廉价、响应感差 | 在核心交互中添加触觉反馈 |
Documentation Lookup (Context7)
文档查询(Context7)
Use then for up-to-date docs. Returned docs override memorized knowledge.
mcp__context7__resolve-library-idmcp__context7__query-docs- — for component API, navigation, or platform-specific modules
react-native - — for widget catalog, state management, or platform channels
flutter
先调用,再调用获取最新文档,返回的文档优先级高于记忆中的知识。
mcp__context7__resolve-library-idmcp__context7__query-docs- — 查询组件API、导航、平台专属模块相关内容
react-native - — 查询组件目录、状态管理、平台通道相关内容
flutter
Integration Points
集成点
| Skill | Integration |
|---|---|
| Color palettes, typography, UX guidelines |
| Design tokens adapted for mobile |
| Mobile data visualization and charts |
| Mobile usability testing |
| React Native component implementation |
| App store submission pipeline |
| Mobile performance profiling |
| 技能 | 集成场景 |
|---|---|
| 色板、排版、UX规范 |
| 适配移动端的设计令牌 |
| 移动端数据可视化和图表 |
| 移动可用性测试 |
| React Native组件实现 |
| 应用商店提交流水线 |
| 移动性能分析 |
Skill Type
技能类型
FLEXIBLE — Adapt patterns to the chosen framework and target platforms. Platform-specific guidelines should be followed when targeting a single platform; cross-platform apps may blend conventions thoughtfully.
灵活适配——根据选择的框架和目标平台调整模式。针对单一平台开发时应当遵循平台专属规范;跨平台应用可合理融合不同平台的交互惯例。