wake-ios/wake/View/Owner/SettingsView.swift
2025-09-01 19:42:32 +08:00

141 lines
4.7 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import SwiftUI
///
struct SettingsView: View {
// MARK: -
/// - dismiss
@Environment(\.dismiss) private var dismiss
/// - /
@Binding var isPresented: Bool
@State private var isShowingAccountView = false
// MARK: -
///
private let animation = Animation.spring(
response: 0.6, //
dampingFraction: 0.9, //
blendDuration: 0.8 //
)
// MARK: -
var body: some View {
NavigationView {
ZStack {
// Theme background color
Color.themeTextWhiteSecondary.edgesIgnoringSafeArea(.all)
VStack(spacing: 0) {
//
SimpleNaviHeader(title: "Setting") {
withAnimation(animation) {
isPresented = false
}
}
//
List {
//
settingRow(
icon: "Account",
title: "Account & Security",
action: {
Router.shared.navigate(to: .account)
}
)
//
settingRow(
icon: "Permission",
title: "Permission Management",
action: {
Router.shared.navigate(to: .permissionManagement)
}
)
//
settingRow(
icon: "Suport",
title: "Support & Service",
action: {}
)
//
settingRow(
icon: "AboutUs",
title: "About Us",
action: {
Router.shared.navigate(to: .about)
}
)
}
.background(Color.white)
.cornerRadius(12)
.padding()
.listStyle(PlainListStyle())
.listRowSeparator(.hidden)
.listRowInsets(EdgeInsets())
.frame(height: CGFloat(5 * 60)) // 4 rows × 60 points each
.frame(maxWidth: .infinity)
Spacer()
}
}
.navigationBarHidden(true)
}
}
// 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: 22, height: 22)
//
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 {
SettingsView(isPresented: .constant(true))
}