Fix stretchy banner header in Edit profile

Put the views into ScrollView
Fixed banner offset in Geometry reader

Changelog-Fixed: Fixed stretchy banner header in Edit profile
Signed-off-by: Swift Coder <scoder1747@gmail.com>
This commit is contained in:
Swift
2025-07-09 17:06:23 -05:00
committed by GitHub
parent b9168f9914
commit f53ffae767

View File

@@ -9,6 +9,7 @@ import SwiftUI
import Combine import Combine
let BANNER_HEIGHT: CGFloat = 150.0; let BANNER_HEIGHT: CGFloat = 150.0;
fileprivate let Scroll_height: CGFloat = 700.0
struct EditMetadataView: View { struct EditMetadataView: View {
let damus_state: DamusState let damus_state: DamusState
@@ -79,11 +80,14 @@ struct EditMetadataView: View {
func topSection(topLevelGeo: GeometryProxy) -> some View { func topSection(topLevelGeo: GeometryProxy) -> some View {
ZStack(alignment: .top) { ZStack(alignment: .top) {
GeometryReader { geo in GeometryReader { geo in
let offset = geo.frame(in: .global).minY
EditBannerImageView(damus_state: damus_state, viewModel: bannerUploadObserver, callback: uploadedBanner(image_url:), safeAreaInsets: topLevelGeo.safeAreaInsets, banner_image: URL(string: banner)) EditBannerImageView(damus_state: damus_state, viewModel: bannerUploadObserver, callback: uploadedBanner(image_url:), safeAreaInsets: topLevelGeo.safeAreaInsets, banner_image: URL(string: banner))
.aspectRatio(contentMode: .fill) .aspectRatio(contentMode: .fill)
.frame(width: geo.size.width, height: BANNER_HEIGHT) .frame(width: geo.size.width, height: offset > 0 ? BANNER_HEIGHT + offset : BANNER_HEIGHT)
.clipped() .clipped()
}.frame(height: BANNER_HEIGHT) .offset(y: offset > 0 ? -offset : 0) // Pin the top
}
.frame(height: BANNER_HEIGHT)
VStack(alignment: .leading) { VStack(alignment: .leading) {
let pfp_size: CGFloat = 90.0 let pfp_size: CGFloat = 90.0
@@ -129,7 +133,9 @@ struct EditMetadataView: View {
func content(topLevelGeo: GeometryProxy) -> some View { func content(topLevelGeo: GeometryProxy) -> some View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
ScrollView(showsIndicators: false) {
self.topSection(topLevelGeo: topLevelGeo) self.topSection(topLevelGeo: topLevelGeo)
Form { Form {
Section(NSLocalizedString("Your Name", comment: "Label for Your Name section of user profile form.")) { Section(NSLocalizedString("Your Name", comment: "Label for Your Name section of user profile form.")) {
let display_name_placeholder = "Satoshi Nakamoto" let display_name_placeholder = "Satoshi Nakamoto"
@@ -198,6 +204,8 @@ struct EditMetadataView: View {
} }
.frame(height: Scroll_height)
}
Button(action: { Button(action: {
if !ln.isEmpty && !is_ln_valid(ln: ln) { if !ln.isEmpty && !is_ln_valid(ln: ln) {