Files
e-party-iOS/yana/Views/AppSettingView.swift
edwinQQQ 3a74547684 feat: 新增应用设置功能及相关视图
- 在MainFeature中集成AppSettingFeature,支持应用设置页面的导航与状态管理。
- 新增AppSettingView以展示用户头像和昵称编辑功能,提升用户体验。
- 更新MainView以支持应用设置页面的展示,增强导航功能。
2025-07-23 20:15:14 +08:00

98 lines
3.9 KiB
Swift

import SwiftUI
import ComposableArchitecture
struct AppSettingView: View {
let store: StoreOf<AppSettingFeature>
var body: some View {
WithViewStore(self.store, observe: { $0 }) { viewStore in
ZStack {
Color(red: 22/255, green: 17/255, blue: 44/255).ignoresSafeArea()
VStack(spacing: 0) {
Spacer().frame(height: 24)
//
Text("Edit")
.font(.system(size: 22, weight: .semibold))
.foregroundColor(.white)
.padding(.top, 8)
//
ZStack(alignment: .bottomTrailing) {
Image("avatar_placeholder")
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 120, height: 120)
.clipShape(Circle())
Button(action: {}) {
ZStack {
Circle().fill(Color.purple).frame(width: 36, height: 36)
Image(systemName: "camera.fill")
.foregroundColor(.white)
}
}
.offset(x: 8, y: 8)
}
.padding(.top, 24)
//
HStack {
Text("Nickname")
.foregroundColor(.white)
Spacer()
Text(viewStore.nickname)
.foregroundColor(.gray)
Image(systemName: "chevron.right")
.foregroundColor(.gray)
}
.padding(.horizontal, 32)
.padding(.vertical, 18)
.onTapGesture {
viewStore.send(.editNicknameTapped)
}
Divider().background(Color.gray.opacity(0.3))
.padding(.horizontal, 32)
//
VStack(spacing: 0) {
settingRow("Personal Information and Permissions")
settingRow("Help")
settingRow("Clear Cache")
settingRow("Check for Updates")
settingRow("Log Out")
settingRow("About Us")
}
.background(Color.clear)
.padding(.horizontal, 0)
Spacer()
//
Button(action: {
viewStore.send(.logoutTapped)
}) {
Text("Log out of account")
.font(.system(size: 18, weight: .semibold))
.foregroundColor(.white)
.frame(maxWidth: .infinity)
.padding(.vertical, 18)
.background(Color.white.opacity(0.08))
.cornerRadius(28)
.padding(.horizontal, 32)
}
.padding(.bottom, 32)
}
}
}
}
//
func settingRow(_ title: String) -> some View {
return VStack(spacing: 0) {
HStack {
Text(title)
.foregroundColor(.white)
Spacer()
Image(systemName: "chevron.right")
.foregroundColor(.gray)
}
.padding(.horizontal, 32)
.padding(.vertical, 18)
Divider().background(Color.gray.opacity(0.3))
.padding(.horizontal, 32)
}
}
}