From 0b2aafe045ee52dd7fe082c5fca512057b41d59c Mon Sep 17 00:00:00 2001 From: wangdl Date: Sat, 30 May 2026 09:27:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(ios):=20=E6=B5=85=E8=89=B2/=E6=B7=B1?= =?UTF-8?q?=E8=89=B2=E5=88=87=E6=8D=A2=E5=9B=BE=E6=A0=87=20+=20ZXSettingRo?= =?UTF-8?q?w=20=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9B=BE?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 icon-sun(太阳)/ icon-moon(月亮)双色图标 - ZXSettingRow 新增 isCustom 参数支持 Asset 图片 - SettingsView 外观行根据当前模式切换图标 Co-Authored-By: Claude Opus 4.7 --- .../Assets.xcassets/Icons/icon-moon.imageset/Contents.json | 1 + .../Assets.xcassets/Icons/icon-moon.imageset/icon-moon.svg | 1 + .../Assets.xcassets/Icons/icon-sun.imageset/Contents.json | 1 + .../Assets.xcassets/Icons/icon-sun.imageset/icon-sun.svg | 1 + AIStudyApp/AIStudyApp/Features/Profile/SettingsView.swift | 7 ++++--- 5 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-moon.imageset/Contents.json create mode 100644 AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-moon.imageset/icon-moon.svg create mode 100644 AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-sun.imageset/Contents.json create mode 100644 AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-sun.imageset/icon-sun.svg diff --git a/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-moon.imageset/Contents.json b/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-moon.imageset/Contents.json new file mode 100644 index 0000000..4552af7 --- /dev/null +++ b/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-moon.imageset/Contents.json @@ -0,0 +1 @@ +{"images":[{"filename":"icon-moon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"template-rendering-intent":"template","preserves-vector-representation":true}} diff --git a/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-moon.imageset/icon-moon.svg b/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-moon.imageset/icon-moon.svg new file mode 100644 index 0000000..e08816d --- /dev/null +++ b/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-moon.imageset/icon-moon.svg @@ -0,0 +1 @@ + diff --git a/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-sun.imageset/Contents.json b/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-sun.imageset/Contents.json new file mode 100644 index 0000000..18a08d2 --- /dev/null +++ b/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-sun.imageset/Contents.json @@ -0,0 +1 @@ +{"images":[{"filename":"icon-sun.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"template-rendering-intent":"template","preserves-vector-representation":true}} diff --git a/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-sun.imageset/icon-sun.svg b/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-sun.imageset/icon-sun.svg new file mode 100644 index 0000000..6872696 --- /dev/null +++ b/AIStudyApp/AIStudyApp/Assets.xcassets/Icons/icon-sun.imageset/icon-sun.svg @@ -0,0 +1 @@ + diff --git a/AIStudyApp/AIStudyApp/Features/Profile/SettingsView.swift b/AIStudyApp/AIStudyApp/Features/Profile/SettingsView.swift index 1e64848..085fb22 100644 --- a/AIStudyApp/AIStudyApp/Features/Profile/SettingsView.swift +++ b/AIStudyApp/AIStudyApp/Features/Profile/SettingsView.swift @@ -21,7 +21,7 @@ struct SettingsView: View { VStack(spacing: 16) { sectionHeader("外观与语言") VStack(spacing: 0) { - ZXSettingRow(title: "外观", value: appearanceLabel, icon: "moon.stars.fill", color: Color.zxPurple) + ZXSettingRow(title: "外观", value: appearanceLabel, icon: appearance == "dark" ? "icon-moon" : "icon-sun", color: Color.zxPurple, isCustom: true) .contentShape(Rectangle()) .onTapGesture { cycleAppearance() } ZXSettingDivider() @@ -156,10 +156,11 @@ struct SettingsView: View { // MARK: - Setting row components struct ZXSettingRow: View { - let title: String; let value: String; let icon: String; let color: Color + let title: String; let value: String; let icon: String; let color: Color; var isCustom: Bool = false var body: some View { HStack(spacing: 12) { - Image(systemName: icon).font(.system(size: 16)).foregroundColor(color).frame(width: 32, height: 32).background(color.opacity(0.12)).clipShape(RoundedRectangle(cornerRadius: 8)) + if isCustom { Image(icon).resizable().scaledToFit().frame(width: 16, height: 16).foregroundColor(color).frame(width: 32, height: 32).background(color.opacity(0.12)).clipShape(RoundedRectangle(cornerRadius: 8)) } + else { Image(systemName: icon).font(.system(size: 16)).foregroundColor(color).frame(width: 32, height: 32).background(color.opacity(0.12)).clipShape(RoundedRectangle(cornerRadius: 8)) } Text(title).font(.system(size: 14, weight: .semibold)).foregroundColor(Color.zxF0) Spacer() if !value.isEmpty { Text(value).font(.system(size: 13)).foregroundColor(Color.zxF03) }