Chuyển đến nội dung
Skillpedia
Ứng dụng di động10k · #11939

wear-compose-m3

Skill này làm gì

Skill này hướng dẫn tạo, cập nhật và chuyển ứng dụng Wear OS dùng thư viện Wear Compose Material 3. Nó bao quát scaffold, danh sách lazy, chế độ ambient và việc chuyển từ Material 2.5 hoặc Horologist. Nó dành cho lập trình viên xây ứng dụng cho đồng hồ thông minh.

Khi nào nên dùng

  • ✓Khi bạn bắt đầu một ứng dụng Wear OS mới với các thành phần Material 3.
  • ✓Khi bạn muốn chuyển ứng dụng đồng hồ từ Material 2.5 hoặc Horologist sang Wear Compose Material 3.
  • ✓Khi bạn cần một danh sách cuộn hoặc màn hình chế độ ambient cho ứng dụng đồng hồ.

Liên kết skill

https://github.com/android/skills/blob/main/wear/wear-compose-m3/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/android/skills/blob/main/wear/wear-compose-m3/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Xây dựng màn hình Wear OS có danh sách cuộn và chế độ ambient bằng Wear Compose Material 3.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill kiểm tra các phiên bản thư viện hiện tại và bản ổn định mới nhất, rồi thiết lập các yêu cầu về Kotlin và SDK. Sau đó nó dùng scaffold và danh sách Material 3 để xây dựng hoặc chuyển các màn hình.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Prerequisites and compatibility

  1. Current Wear OS Compose version in-use: To find the installed library version, read gradle/libs.versions.toml or build.gradle.kts directly. Don't run ./gradlew dependencies or other shell commands to resolve versions.
  2. Wear OS Compose Material3 version: If an internal tool is available to establish the latest stable version {VERSION} of androidx.wear.compose:compose-material3, use that tool.
  3. Strict compliance: If a version is listed as stable, you MUST use it, unless overridden by the user. Do not downgrade based on initial "Unresolved reference" errors in the editor or outdated web search results.
  4. Kotlin & Compose compiler: Use Kotlin 2.0.0+ with the org.jetbrains.kotlin.plugin.compose Gradle plugin.
  5. Min SDK: Ensure minSdk is at least 25.
  6. Compile SDK & AGP: Ensure compileSdk and AGP meet the library's AAR metadata floors (compileSdk >= 35 and AGP >= 8.6.0 for 1.6.x; compileSdk >= 37 and AGP >= 9.1.0 for 1.7.x).

Gotchas

  1. Mandatory sync and validation: After updating versions in libs.versions.toml or build.gradle.kts, perform a Gradle sync (or ./gradlew assembleDebug) before refactoring, and run ./gradlew assembleDebug after refactoring to verify the build.
  2. Prohibition of guessing (error protocol): If you encounter an 'Unresolved Reference' or API mismatch after a successful sync, do not attempt to 'fix' it by downgrading the library version.

Capabilities and tools

Capability 1: Migration, updates, and adding features

Use this guidance when migrating from an older version of Wear OS Compose or Horologist, updating an existing Wear Compose Material3 project, or adding features.

  1. Unless otherwise indicated by the developer, use the latest stable version of Wear Compose Material3 from {VERSION} (superseding any literal version strings in the migration guide).
  2. When migrating from Material 2.5 or Horologist, read the migration guide and use its official component mappings.
  3. Before refactoring any component (for example, Chip -> Button), check the parameter names, slot types, and "Expressive" design tokens.
  4. Do not use the Horologist Composables, Compose Layout, or Compose Material libraries; replace Horologist components with Wear Compose M3 equivalents (AppScaffold -> M3 AppScaffold, ScreenScaffold -> M3 ScreenScaffold, ScalingLazyColumn -> TransformingLazyColumn, ResponsiveListHeader -> ListHeader, PagerScreen -> HorizontalPagerScaffold, Chip -> Button, Confirmation -> ConfirmationDialog).
  5. Always check against the component guidance in Capability 3.
  6. Expect screenshot tests to fail when migrating or updating components: expected defaults for padding and positioning will have changed. Do not seek to artificially match the previous screenshot, but give preference to the Material3 defaults.

Capability 2: Component samples

Use this table of reference to find canonical samples for Wear Compose components. When working with a Wear Compose component, you must use the samples linked from the table to ensure you know how to correctly use it.

Important: Symbols marked with [alpha], [beta], or [rc] are only available in that pre-release track and are not in stable {VERSION}. Do not use them unless the project explicitly targets that pre-release version.

Material 3 components in androidx.wear.compose.material3.*

Component / Symbol Reference Samples
AlertDialog, AlertDialogDefaults AlertDialogSample
AnimatedPage, HorizontalPagerScaffold, VerticalPagerScaffold OneHandedGestureSamples, PageIndicatorSample, PagerScaffoldSample
AnimatedText, rememberAnimatedTextFontRegistry AnimatedTextSample
AppCard CardSample
AppScaffold [ListHeaderSample](re
Câu hỏi thường gặp

Nó dùng phiên bản thư viện nào?

Nó dùng phiên bản ổn định mới nhất, trừ khi bạn yêu cầu phiên bản khác.

Yêu cầu minSdk và Kotlin tối thiểu là gì?

Skill yêu cầu minSdk ít nhất 25 và Kotlin 2.0.0 trở lên.

Nó có chạy lệnh shell để tìm phiên bản không?

Không. Nó đọc trực tiếp các file build của bạn và kiểm tra metadata Maven chính thức khi cần.

Chi tiết

Mô tả gốc của tác giả

Guidance for Wear OS Compose Material3 (Wear Compose Material 3 / Wear Compose Material3) watch and wearable apps. Covers creating, updating, and migrating projects (Material 2.5 and Horologist migration) using androidx.wear.compose.material3, androidx.wear.compose.foundation, and androidx.wear.compose.navigation3, including AppScaffold, ScreenScaffold, TransformingLazyColumn, ambient mode, and previews.

repo: android/skills

Độ phổ biến

Sao GitHub
10k
Vị trí xếp hạng
#11939
Giấy phép
Apache-2.0
Cập nhật
29/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự