feat: setting样式
This commit is contained in:
parent
35962c644e
commit
095d95b420
Binary file not shown.
@ -35,16 +35,13 @@ struct SettingsView: View {
|
|||||||
Image(systemName: "chevron.left")
|
Image(systemName: "chevron.left")
|
||||||
.font(.system(size: 16, weight: .medium))
|
.font(.system(size: 16, weight: .medium))
|
||||||
.foregroundColor(.blue)
|
.foregroundColor(.blue)
|
||||||
Text("返回")
|
|
||||||
.font(.system(size: 17, weight: .regular))
|
|
||||||
.foregroundColor(.blue)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
// 标题
|
// 标题
|
||||||
Text("设置")
|
Text("Setting")
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
@ -53,51 +50,52 @@ struct SettingsView: View {
|
|||||||
Color.clear
|
Color.clear
|
||||||
.frame(width: 44, height: 44)
|
.frame(width: 44, height: 44)
|
||||||
}
|
}
|
||||||
.padding(.horizontal)
|
.padding(.horizontal,16)
|
||||||
.padding(.vertical, 8)
|
.padding(.vertical, 8)
|
||||||
.background(Color(.systemBackground))
|
|
||||||
|
|
||||||
// 设置项列表
|
// 设置项列表
|
||||||
List {
|
List {
|
||||||
// 空Section用于调整间距
|
|
||||||
Section { EmptyView() }
|
|
||||||
|
|
||||||
// 账号与安全
|
// 账号与安全
|
||||||
settingRow(
|
settingRow(
|
||||||
icon: "person.crop.circle",
|
icon: "person.crop.circle",
|
||||||
title: "账号与安全",
|
title: "Account & Security",
|
||||||
action: {}
|
action: {}
|
||||||
)
|
)
|
||||||
|
|
||||||
// 权限管理
|
// 权限管理
|
||||||
settingRow(
|
settingRow(
|
||||||
icon: "lock.shield",
|
icon: "lock.shield",
|
||||||
title: "权限管理",
|
title: "Permission Management",
|
||||||
action: {}
|
action: {}
|
||||||
)
|
)
|
||||||
|
|
||||||
// 支持与服务
|
// 支持与服务
|
||||||
settingRow(
|
settingRow(
|
||||||
icon: "questionmark.circle",
|
icon: "questionmark.circle",
|
||||||
title: "支持与服务",
|
title: "Support & Service",
|
||||||
action: {}
|
action: {}
|
||||||
)
|
)
|
||||||
|
|
||||||
// 关于我们
|
// 关于我们
|
||||||
settingRow(
|
settingRow(
|
||||||
icon: "info.circle",
|
icon: "info.circle",
|
||||||
title: "关于我们",
|
title: "About Us",
|
||||||
action: {}
|
action: {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.listStyle(GroupedListStyle())
|
// 设置列表样式为普通样式(无分组效果)
|
||||||
|
.listStyle(PlainListStyle())
|
||||||
|
// 隐藏所有行的分割线
|
||||||
|
.listRowSeparator(.hidden)
|
||||||
|
// 移除列表行的内边距
|
||||||
.listRowInsets(EdgeInsets())
|
.listRowInsets(EdgeInsets())
|
||||||
|
.background(Color(.systemGroupedBackground))
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.background(Color(.systemBackground))
|
.background(Color(.systemGroupedBackground))
|
||||||
|
// 设置水平尺寸类别为常规宽度(regular),用于支持分屏和不同设备尺寸的布局
|
||||||
.environment(\.horizontalSizeClass, .regular)
|
.environment(\.horizontalSizeClass, .regular)
|
||||||
.environment(\.defaultMinListRowHeight, 50)
|
|
||||||
.onAppear(perform: configureTableView)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - 私有方法
|
// MARK: - 私有方法
|
||||||
@ -106,6 +104,8 @@ struct SettingsView: View {
|
|||||||
private func configureTableView() {
|
private func configureTableView() {
|
||||||
// 移除列表底部分隔线
|
// 移除列表底部分隔线
|
||||||
UITableView.appearance().tableFooterView = UIView()
|
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().separatorInset = .zero
|
||||||
// 移除列表顶部额外间距
|
// 移除列表顶部额外间距
|
||||||
@ -138,12 +138,13 @@ struct SettingsView: View {
|
|||||||
.font(.system(size: 14))
|
.font(.system(size: 14))
|
||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
}
|
}
|
||||||
.padding(.vertical, 12)
|
.padding(.vertical, 6) // 减少垂直内边距
|
||||||
.padding(.horizontal, 16)
|
.padding(.horizontal, 12)
|
||||||
.background(Color(.systemBackground))
|
.background(Color(.systemGroupedBackground))
|
||||||
}
|
}
|
||||||
.buttonStyle(PlainButtonStyle())
|
.buttonStyle(PlainButtonStyle())
|
||||||
.listRowBackground(Color(.systemBackground))
|
.listRowBackground(Color(.systemGroupedBackground))
|
||||||
|
.listRowSeparator(.hidden)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user