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