wake-ios/wake/View/Owner/Account.swift
2025-08-31 15:49:05 +08:00

113 lines
3.4 KiB
Swift

import SwiftUI
///
struct AccountView: View {
// MARK: -
/// - dismiss
@Environment(\.dismiss) private var dismiss
/// - /
@Binding var isAccountPresented: Bool
// MARK: -
///
private let animation = Animation.spring(
response: 0.6, //
dampingFraction: 0.9, //
blendDuration: 0.8 //
)
// MARK: -
var body: some View {
ZStack {
// Theme background color
Color.themeTextWhiteSecondary.edgesIgnoringSafeArea(.all)
VStack(spacing: 0) {
//
SimpleNaviHeader(title: "Account & Security") {
withAnimation(animation) {
isAccountPresented = false
}
}
//
List {
//
settingRow(
icon: "Account",
title: "Account & Security",
action: {}
)
}
.background(Color.white)
.cornerRadius(12)
.padding()
.listStyle(PlainListStyle())
.listRowSeparator(.hidden)
.listRowInsets(EdgeInsets())
}
}
.background(Color.themeTextWhiteSecondary.edgesIgnoringSafeArea(.all))
.environment(\.horizontalSizeClass, .regular)
}
// MARK: -
/// TableView
private func configureTableView() {
// 线
UITableView.appearance().tableFooterView = UIView()
// 线
UITableView.appearance().tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: CGFloat.leastNonzeroMagnitude))
// 线
UITableView.appearance().separatorInset = .zero
//
UITableView.appearance().contentInset = .zero
}
///
/// - Parameters:
/// - icon:
/// - title:
/// - action:
/// - Returns:
private func settingRow(icon: String, title: String, action: @escaping () -> Void) -> some View {
Button(action: action) {
HStack {
//
SVGImage(svgName: icon)
.frame(width: 24, height: 24)
//
Text(title)
.foregroundColor(.primary)
Spacer()
//
Image(systemName: "chevron.right")
.font(.system(size: 14))
.foregroundColor(.gray)
}
.padding(.vertical, 12) //
.background(Color.white)
}
.buttonStyle(PlainButtonStyle())
.listRowBackground(Color.white)
.listRowSeparator(.hidden)
}
}
// MARK: -
#Preview {
NavigationView {
AccountView(isAccountPresented: .constant(true))
}
}