| 页面 | 用到的技术 |
|---|---|
| 主框架 MainPage | 5 Tab + ThemeStore + TabStore |
| 首页 HomePage | WaterfallList + vfor + Refresh + scrollEnd |
| 发现 ExplorePage | 横向 Scroller + 分类切换 |
| 发布 PublishPage | Input + TextArea + 自定义 CameraModule |
| 消息 MessagePage | List + vfor + 红点 |
| 我的 ProfilePage | UserStore + ThemeStore + 设置项 |
| 登录 LoginPage | 双向绑定 + 派生属性 |
| 详情 NoteDetailPage | Scroller + 评论列表 + 操作栏 |
UserStore.loggedIn = false
UserStore.nickname = "游客"
ThemeStore.darkMode = false
TabStore.currentTab = "home"
NoteStore.notes.size = 0
@Page("MainPage")
internal class MainPage : Pager() {
override fun body() = {
attr {
backgroundColor(
if (ThemeStore.darkMode) Color(0xFF121212L)
else Color(0xFFF5F5F7L)
)
}
View { // 内容区
attr { flex(1f) }
when (TabStore.currentTab) {
"home" -> HomePage().body().invoke(this)
"explore" -> ExplorePage().body().invoke(this)
"publish" -> PublishPage().body().invoke(this)
"message" -> MessagePage().body().invoke(this)
"profile" -> ProfilePage().body().invoke(this)
}
}
BottomTabBar( // 底 Tab
current = TabStore.currentTab,
onSelect = { TabStore.currentTab = it },
).invoke(this)
}
}
🎉 恭喜你看完了整套 Kuikly 学习笔记!