fix(settings): 调整系统式设置布局并修正应用图标留白

This commit is contained in:
2026-10-30 16:54:16 +08:00
parent c2f0549568
commit 5b71e5bd80
16 changed files with 93 additions and 99 deletions
@@ -18,31 +18,16 @@ struct AppearanceSettingsView: View {
}
}
.listStyle(.sidebar)
.navigationSplitViewColumnWidth(min: 160, ideal: 175, max: 200)
.safeAreaInset(edge: .bottom) {
HStack(spacing: 8) {
Image("BrandLogo").resizable().frame(width: 34, height: 34)
Text(verbatim: "Kymo").font(.headline)
Spacer()
}
.padding(12)
}
.navigationSplitViewColumnWidth(min: 180, ideal: 205, max: 240)
} detail: {
ScrollView {
VStack(alignment: .leading, spacing: 22) {
Text((selection ?? .appearance).title)
.font(.largeTitle.bold())
switch selection ?? .appearance {
case .appearance: appearancePage
case .language: languagePage
case .about: aboutPage
}
Group {
switch selectedPage {
case .appearance: appearancePage
case .language: languagePage
case .about: aboutPage
}
.frame(maxWidth: 480, alignment: .leading)
.padding(28)
.frame(maxWidth: .infinity, alignment: .topLeading)
}
.background(.regularMaterial)
.navigationTitle(selectedPage.title)
}
.navigationSplitViewStyle(.balanced)
.background(SettingsWindowLifecycle(title: AppLocalization.string("settings.title", locale: locale),
@@ -58,82 +43,101 @@ struct AppearanceSettingsView: View {
} else { colorPicker.close() }
}
.onChange(of: selection) { _, _ in colorPicker.close() }
.frame(minWidth: 680, idealWidth: 740, minHeight: 450, idealHeight: 500)
.frame(minWidth: 720, idealWidth: 780, minHeight: 460, idealHeight: 540)
.modifier(AppearanceStyle(preferences: preferences))
}
private var selectedPage: SettingsPage { selection ?? .appearance }
private var appearancePage: some View {
glassCard {
VStack(alignment: .leading, spacing: 12) {
Text("appearance.title").font(.headline)
Picker("appearance.title", selection: $preferences.appearance) {
Text("appearance.system").tag(AppAppearance.system)
Text("appearance.light").tag(AppAppearance.light)
Text("appearance.dark").tag(AppAppearance.dark)
Form {
Section {
LabeledContent("appearance.title") {
Picker("appearance.title", selection: $preferences.appearance) {
Text("appearance.system").tag(AppAppearance.system)
Text("appearance.light").tag(AppAppearance.light)
Text("appearance.dark").tag(AppAppearance.dark)
}
.labelsHidden()
.pickerStyle(.segmented)
.fixedSize()
}
.labelsHidden()
.pickerStyle(.segmented)
}
Divider()
HStack {
Text("accent.title").font(.headline)
Spacer()
Picker("accent.title", selection: $preferences.accent) {
Text("accent.system").tag(AccentChoice.system)
Text("accent.blue").tag(AccentChoice.blue)
Text("accent.purple").tag(AccentChoice.purple)
Text("accent.teal").tag(AccentChoice.teal)
Text("accent.green").tag(AccentChoice.green)
Text("accent.orange").tag(AccentChoice.orange)
Text("accent.pink").tag(AccentChoice.pink)
Text("accent.custom").tag(AccentChoice.custom)
LabeledContent("accent.title") {
Picker("accent.title", selection: $preferences.accent) {
Text("accent.system").tag(AccentChoice.system)
Text("accent.blue").tag(AccentChoice.blue)
Text("accent.purple").tag(AccentChoice.purple)
Text("accent.teal").tag(AccentChoice.teal)
Text("accent.green").tag(AccentChoice.green)
Text("accent.orange").tag(AccentChoice.orange)
Text("accent.pink").tag(AccentChoice.pink)
Text("accent.custom").tag(AccentChoice.custom)
}
.labelsHidden()
.fixedSize()
}
.labelsHidden()
.fixedSize()
.buttonStyle(.glass)
}
if preferences.accent == .custom {
Divider()
HStack {
Text("accent.custom").font(.headline)
Spacer()
CustomColorWell(preferences: preferences, picker: colorPicker)
.frame(width: 44, height: 26)
if preferences.accent == .custom {
LabeledContent("accent.custom") {
CustomColorWell(preferences: preferences, picker: colorPicker)
.frame(width: 44, height: 26)
}
}
}
}
.formStyle(.grouped)
.padding(.horizontal, 12)
.padding(.top, 6)
}
private var languagePage: some View {
glassCard {
HStack {
Text("language.title").font(.headline)
Spacer()
Picker("language.title", selection: $language.language) {
Text("language.system").tag(AppLanguage.system)
Text(verbatim: "简体中文").tag(AppLanguage.simplifiedChinese)
Text(verbatim: "繁體中文").tag(AppLanguage.traditionalChinese)
Text(verbatim: "English").tag(AppLanguage.english)
Form {
Section {
LabeledContent("language.title") {
Picker("language.title", selection: $language.language) {
Text("language.system").tag(AppLanguage.system)
Text(verbatim: "简体中文").tag(AppLanguage.simplifiedChinese)
Text(verbatim: "繁體中文").tag(AppLanguage.traditionalChinese)
Text(verbatim: "English").tag(AppLanguage.english)
}
.labelsHidden()
.fixedSize()
}
.labelsHidden()
.fixedSize()
.buttonStyle(.glass)
Text("language.immediate")
.font(.callout)
.foregroundStyle(.secondary)
}
Text("language.immediate").font(.callout).foregroundStyle(.secondary)
}
.formStyle(.grouped)
.padding(.horizontal, 12)
.padding(.top, 6)
}
private var aboutPage: some View {
glassCard {
VStack(spacing: 16) {
Image("BrandLogo").resizable().scaledToFit().frame(width: 112, height: 112)
.accessibilityHidden(true)
Text(verbatim: "Kymo").font(.system(size: 28, weight: .bold))
Text("about.version \(version)").font(.callout).foregroundStyle(.secondary)
Text("about.description").multilineTextAlignment(.center).foregroundStyle(.secondary)
Form {
Section {
HStack(alignment: .top, spacing: 18) {
Image("BrandLogo")
.resizable()
.scaledToFit()
.frame(width: 88, height: 88)
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 7) {
Text(verbatim: "Kymo").font(.title2.bold())
Text("about.version \(version)")
.font(.callout)
.foregroundStyle(.secondary)
Text("about.description")
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
}
Spacer(minLength: 0)
}
.padding(.vertical, 8)
}
.frame(maxWidth: .infinity).padding(.vertical, 16)
}
.formStyle(.grouped)
.padding(.horizontal, 12)
.padding(.top, 6)
}
private var version: String {
@@ -142,13 +146,6 @@ struct AppearanceSettingsView: View {
let build = bundle.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "--"
return "\(version) (\(build))"
}
private func glassCard<Content: View>(@ViewBuilder content: () -> Content) -> some View {
VStack(alignment: .leading, spacing: 18, content: content)
.padding(22)
.frame(maxWidth: .infinity, alignment: .leading)
.glassEffect(.regular, in: .rect(cornerRadius: 22))
}
}
private enum SettingsPage: String, CaseIterable, Identifiable {