style(settings): center the About section on the page
AboutInfoView (icon/name/version/links) now centers both horizontally and vertically within the detail pane instead of sitting pinned to the top-left like the other sections. Needed a GeometryReader + minHeight on the shared ScrollView wrapper — a ScrollView proposes unbounded height to its content, so maxHeight: .infinity alone doesn't give short content anything to center within; minHeight pinned to the real viewport height does. Harmless for the other sections, which stay top/leading-aligned as before.
This commit is contained in:
@@ -36,10 +36,21 @@ struct SettingsView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
// GeometryReader + `minHeight` (not `maxHeight`) is the actual fix for
|
||||||
|
// "center short content inside a ScrollView" — a ScrollView proposes
|
||||||
|
// effectively unbounded height to its content, so `maxHeight: .infinity`
|
||||||
|
// alone just resolves to the content's own intrinsic size and does
|
||||||
|
// nothing; forcing a `minHeight` equal to the real viewport height is
|
||||||
|
// what gives `aboutDetail`'s own centered alignment somewhere to
|
||||||
|
// actually center within. Harmless for the other (already
|
||||||
|
// top/leading-aligned) sections — short ones just get blank space
|
||||||
|
// below, same as before.
|
||||||
|
GeometryReader { geometry in
|
||||||
ScrollView {
|
ScrollView {
|
||||||
sectionDetail
|
sectionDetail
|
||||||
.padding(28)
|
.padding(28)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, minHeight: geometry.size.height, alignment: .leading)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.background(.background)
|
.background(.background)
|
||||||
@@ -340,11 +351,12 @@ struct SettingsView: View {
|
|||||||
// MARK: - About
|
// MARK: - About
|
||||||
|
|
||||||
private var aboutDetail: some View {
|
private var aboutDetail: some View {
|
||||||
VStack(alignment: .leading, spacing: 16) {
|
VStack(spacing: 16) {
|
||||||
sectionHeader
|
sectionHeader
|
||||||
AboutInfoView()
|
AboutInfoView()
|
||||||
.frame(maxWidth: 420, alignment: .leading)
|
.frame(maxWidth: 420)
|
||||||
}
|
}
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Helpers
|
// MARK: - Helpers
|
||||||
|
|||||||
Reference in New Issue
Block a user