From 4bee45c8e02e815b03b0de878bc2442b072b72e3 Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Sat, 7 Mar 2026 21:28:27 +0800 Subject: [PATCH] Use material icons in chat app bar --- composeApp/build.gradle.kts | 1 + .../kotlin/cn/xiaobai/openclawapp/App.kt | 29 ++++++++++++++----- docs/MVP_PROGRESS.md | 1 + gradle/libs.versions.toml | 1 + 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 37db81a..66f1897 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -53,6 +53,7 @@ kotlin { implementation(libs.compose.runtime) implementation(libs.compose.foundation) implementation(libs.compose.material3) + implementation(libs.compose.material.iconsExtended) implementation(libs.compose.ui) implementation(libs.compose.components.resources) implementation(libs.compose.uiToolingPreview) diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt index 2cbcaf0..e4cdcc4 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt @@ -3,14 +3,18 @@ package cn.xiaobai.openclawapp import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ArrowBack +import androidx.compose.material.icons.filled.AttachFile +import androidx.compose.material.icons.filled.Refresh import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Button +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem import androidx.compose.material3.Scaffold import androidx.compose.material3.Text -import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -149,15 +153,21 @@ private fun OpenClawRoot(appState: OpenClawAppState) { ) }, navigationIcon = { - TextButton(onClick = appState::closeChat) { - Text("←") + IconButton(onClick = appState::closeChat) { + Icon( + imageVector = Icons.AutoMirrored.Filled.ArrowBack, + contentDescription = "返回", + ) } }, actions = { - TextButton(onClick = { pickAttachment() }) { - Text("+") + IconButton(onClick = { pickAttachment() }) { + Icon( + imageVector = Icons.Filled.AttachFile, + contentDescription = "附件", + ) } - TextButton(onClick = { + IconButton(onClick = { activeSession?.id?.let { sessionId -> coroutineScope.launch { appState.clearSyncError() @@ -165,7 +175,10 @@ private fun OpenClawRoot(appState: OpenClawAppState) { } } }) { - Text(if (appState.repository.streamStatusFor(route.sessionId) == "failed") "⟳" else "↻") + Icon( + imageVector = Icons.Filled.Refresh, + contentDescription = if (appState.repository.streamStatusFor(route.sessionId) == "failed") "重连" else "刷新", + ) } }, ) diff --git a/docs/MVP_PROGRESS.md b/docs/MVP_PROGRESS.md index cb7a565..9c20b1f 100644 --- a/docs/MVP_PROGRESS.md +++ b/docs/MVP_PROGRESS.md @@ -452,3 +452,4 @@ Android/iOS App - 2026-03-07:信息架构继续做减法:底部导航先从三栏收成两栏(会话 / 设置),把原状态页的核心诊断信息并进设置页的“诊断信息”分组,避免低频诊断页长期占一个一级入口。 - 2026-03-07:继续给聊天页降噪:正常在线时顶部状态条不再常驻,只在同步 / 发送 / 恢复 / 断流等需要用户感知时才显示;状态文案改成更短的移动端提示,同时去掉用户消息“已发送”和附件“已完成”这类长期占位但信息价值不高的状态露出。 - 2026-03-07:会话页顶栏操作再收成图标化按钮:返回 / 附件 / 刷新不再显示整词文本,而是先用轻量符号按钮(← / + / ↻/⟳)表达,减少顶栏横向拥挤;后续如果需要,再统一切成正式 Material Icons 资源。 +- 2026-03-07:把会话页顶栏的占位符号按钮升级为正式 Material Icons:返回改为 `ArrowBack`,附件改为 `AttachFile`,刷新/重连改为 `Refresh`,让导航头从临时占位过渡到更像成品的视觉语义。 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e5273e2..07bc0a4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,6 +32,7 @@ androidx-lifecycle-runtimeCompose = { module = "org.jetbrains.androidx.lifecycle compose-runtime = { module = "org.jetbrains.compose.runtime:runtime", version.ref = "composeMultiplatform" } compose-foundation = { module = "org.jetbrains.compose.foundation:foundation", version.ref = "composeMultiplatform" } compose-material3 = { module = "org.jetbrains.compose.material3:material3", version.ref = "material3" } +compose-material-iconsExtended = { module = "org.jetbrains.compose.material:material-icons-extended", version.ref = "composeMultiplatform" } compose-ui = { module = "org.jetbrains.compose.ui:ui", version.ref = "composeMultiplatform" } compose-components-resources = { module = "org.jetbrains.compose.components:components-resources", version.ref = "composeMultiplatform" } compose-uiToolingPreview = { module = "org.jetbrains.compose.ui:ui-tooling-preview", version.ref = "composeMultiplatform" }