Files
life-echo/skills/android-navigation-routing.md
iammm0 6526c08c3a docs: 新增技能文档
- 新增Skills.md技能说明
- 新增skills/技能文档目录

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-03 11:30:12 +08:00

25 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SkillAndroid 路由与页面导航
与具体业务无关的 Android 路由与 NavHost 设计:路由定义、转场与返回栈。
---
## 路由定义
- 使用 **Screen** sealed class所有路由字符串集中定义`Screen.ConversationList.route``Screen.CreateMemory.createRoute(conversationId)` 等)。
## NavHost
-**AppNavigation** 中统一注册 `composable(route = ..., enterTransition = ..., exitTransition = ..., popEnterTransition = ..., popExitTransition = ...)`
- 转场动画由 **NavigationTransitions** 提供:水平进出(如 `slideInHorizontally``slideOutHorizontally`)、从左侧返回(`slideInHorizontallyFromLeft``slideOutHorizontallyToRight`)、淡入淡出、缩放等,按页面类型选用。
## 起始目的地
- `startDestination = if (isLoggedIn) Screen.ConversationList.route else Screen.Login.route`,与 TokenManager 的登录状态一致。
## 返回栈
- 登录后进入主界面:`popUpTo(Screen.Login.route) { inclusive = true }`
- 登出:`popUpTo(0) { inclusive = true }` 清空栈再 navigate 到 Login。
- Tab 切换时按设计选择 `popUpTo(ConversationList)` 等,避免栈过深。