refactor(settings): 统一单色下拉选择器并收窄窗口
This commit is contained in:
@@ -246,3 +246,5 @@ GPU 核心数格式文案按面板 SwiftUI locale 通过 AppLocalization 解析
|
||||
AppKit 场景与面板的语言环境通过 UI 层 `AppLanguageScope` 注入:在 SwiftUI body 内观察 LanguagePreferences,避免在一次性的宿主构造闭包中固定 locale。设置容器的语言变化回调重建原生主菜单,保留当前设置页及进程搜索等视图状态。
|
||||
|
||||
悬浮提示收敛为操作用途、输入约束及精确数据读取。进程标题不再承载覆盖计数/采样语义说明,资源卡片不再接受 statusHelp;长篇指标解释及重复标签不通过 help 展示,图表数据悬浮层保持原有实现。
|
||||
|
||||
设置中的外观/语言菜单 Picker 使用局部 primary tint(深浅模式的黑白灰),其余交互默认蓝色;设置内容宽度固定 520pt。已删除外观专用玻璃分段选择器,不改变外观偏好及系统主题解析。
|
||||
|
||||
@@ -32,3 +32,9 @@
|
||||
前一轮使用独立 NSWindow,不能代表 Settings 场景对 TabView 的系统呈现。现改为 principal 工具栏中的原生分段 Picker,内容按选中页切换,使正式设置场景保持文字胶囊样式。
|
||||
|
||||
Debug 构建通过;本轮隔离 app 使用与应用一致的 NSHostingSceneRepresentation + Settings + openSettings 入口加载实际设置源码,AX 确认窗口为 com_apple_SwiftUI_Settings_window,截图确认顶部胶囊及无图标页签,实际点击关于页成功。没有操作用户已有进程。
|
||||
|
||||
## 紧凑单色选择器
|
||||
|
||||
外观与语言统一使用原生菜单 Picker,局部 tint 为 primary,随深浅模式呈现黑白灰;删除不再使用的液态外观分段组件和图标映射。设置内容宽度固定 520pt,避免 Settings 场景恢复为过宽窗口。
|
||||
|
||||
Debug 构建通过;隔离 app 使用实际 Settings 场景及真实源码,实测浅色/深色菜单切换、英文/繁体中文即时切换;截图复核 520pt 下三语标签未截断,英文说明正常换行,选择器无蓝色强调。没有修改用户现有应用及偏好。系统弹出菜单的悬停高亮仍由 macOS 管理。
|
||||
|
||||
@@ -32,7 +32,8 @@ struct AppearanceSettingsView: View {
|
||||
}
|
||||
.background(SettingsWindowLifecycle(title: AppLocalization.string("settings.title", locale: locale),
|
||||
requestID: presentation.requestID))
|
||||
.frame(minWidth: 600, idealWidth: 640, minHeight: 420, idealHeight: 460)
|
||||
.frame(width: 520)
|
||||
.frame(minHeight: 420, idealHeight: 460)
|
||||
.modifier(AppearanceStyle(preferences: preferences, refreshContentOnChange: true))
|
||||
}
|
||||
|
||||
@@ -40,7 +41,15 @@ struct AppearanceSettingsView: View {
|
||||
Form {
|
||||
Section {
|
||||
LabeledContent("appearance.title") {
|
||||
LiquidAppearancePicker(selection: $preferences.appearance)
|
||||
Picker("appearance.title", selection: $preferences.appearance) {
|
||||
ForEach(AppAppearance.allCases) { appearance in
|
||||
Text(appearance.title).tag(appearance)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.menu)
|
||||
.labelsHidden()
|
||||
.fixedSize()
|
||||
.tint(.primary)
|
||||
}
|
||||
LabeledContent("language.title") {
|
||||
Picker("language.title", selection: $language.language) {
|
||||
@@ -49,8 +58,10 @@ struct AppearanceSettingsView: View {
|
||||
Text(verbatim: "繁體中文").tag(AppLanguage.traditionalChinese)
|
||||
Text(verbatim: "English").tag(AppLanguage.english)
|
||||
}
|
||||
.pickerStyle(.menu)
|
||||
.labelsHidden()
|
||||
.fixedSize()
|
||||
.tint(.primary)
|
||||
}
|
||||
}
|
||||
Section {
|
||||
@@ -99,49 +110,6 @@ struct AppearanceSettingsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private struct LiquidAppearancePicker: View {
|
||||
@Binding var selection: AppAppearance
|
||||
@Environment(\.accessibilityReduceMotion) private var reduceMotion
|
||||
@Namespace private var selectionNamespace
|
||||
|
||||
var body: some View {
|
||||
GlassEffectContainer(spacing: 10) {
|
||||
HStack(spacing: 4) {
|
||||
ForEach(AppAppearance.allCases) { appearance in
|
||||
Button {
|
||||
// Theme changes must not animate the native tab view / Form hierarchy.
|
||||
selection = appearance
|
||||
} label: {
|
||||
Label(appearance.title, systemImage: appearance.symbol)
|
||||
.labelStyle(.titleAndIcon)
|
||||
.font(.system(size: 13, weight: .medium))
|
||||
.foregroundStyle(selection == appearance ? .primary : .secondary)
|
||||
.padding(.horizontal, 11)
|
||||
.frame(minWidth: 108, minHeight: 34)
|
||||
.contentShape(.capsule)
|
||||
.background {
|
||||
if selection == appearance {
|
||||
Capsule()
|
||||
.fill(.clear)
|
||||
.glassEffect(.regular.interactive(), in: .capsule)
|
||||
.glassEffectID("appearance-selection", in: selectionNamespace)
|
||||
.glassEffectTransition(.matchedGeometry)
|
||||
}
|
||||
}
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityAddTraits(selection == appearance ? .isSelected : [])
|
||||
}
|
||||
}
|
||||
.padding(4)
|
||||
.glassEffect(.regular, in: .capsule)
|
||||
}
|
||||
.animation(reduceMotion ? nil : .smooth(duration: 0.24), value: selection)
|
||||
.accessibilityElement(children: .contain)
|
||||
.accessibilityLabel(Text("appearance.title"))
|
||||
}
|
||||
}
|
||||
|
||||
private extension AppAppearance {
|
||||
var title: LocalizedStringKey {
|
||||
switch self {
|
||||
@@ -151,13 +119,6 @@ private extension AppAppearance {
|
||||
}
|
||||
}
|
||||
|
||||
var symbol: String {
|
||||
switch self {
|
||||
case .system: "circle.lefthalf.filled"
|
||||
case .light: "sun.max.fill"
|
||||
case .dark: "moon.fill"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum SettingsPage: Hashable {
|
||||
|
||||
Reference in New Issue
Block a user