feat: userrname

This commit is contained in:
jinyaqiu 2025-08-21 16:43:26 +08:00
parent 44de40cf83
commit 599ea6eae7
5 changed files with 54 additions and 31 deletions

View File

@ -7,7 +7,7 @@
<key>wake.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>0</integer>
</dict>
</dict>
</dict>

View File

@ -23,7 +23,7 @@
<key>UIAppFonts</key>
<array>
<string>Inter.ttf</string>
<string>Quicksand X.ttf</string>
<string>Quicksand x.ttf</string>
<string>Quicksand-Regular.ttf</string>
<string>Quicksand-Bold.ttf</string>
<string>Quicksand-SemiBold.ttf</string>

View File

@ -5,9 +5,11 @@ public struct AvatarPicker: View {
@State private var showMediaPicker = false
@State private var isUploading = false
@Binding var selectedImage: UIImage?
@Binding var showUsername: Bool
public init(selectedImage: Binding<UIImage?>) {
public init(selectedImage: Binding<UIImage?>, showUsername: Binding<Bool>) {
self._selectedImage = selectedImage
self._showUsername = showUsername
}
public var body: some View {
@ -37,23 +39,25 @@ public struct AvatarPicker: View {
}
}
}
// Upload button
Button(action: {
showMediaPicker = true
}) {
Text("Upload from Gallery")
.font(Typography.font(for: .subtitle, family: .inter))
.fontWeight(.regular)
.frame(maxWidth: .infinity)
.padding()
.foregroundColor(.black)
.background(
RoundedRectangle(cornerRadius: 16)
.fill(Color.themePrimaryLight)
)
if !showUsername {
// Upload button
Button(action: {
showMediaPicker = true
}) {
Text("Upload from Gallery")
.font(Typography.font(for: .subtitle, family: .inter))
.fontWeight(.regular)
.frame(maxWidth: .infinity)
.padding()
.foregroundColor(.black)
.background(
RoundedRectangle(cornerRadius: 16)
.fill(Color.themePrimaryLight)
)
}
.frame(maxWidth: .infinity)
}
.frame(width: .infinity)
}
.sheet(isPresented: $showMediaPicker) {
MediaPicker(

View File

@ -4,12 +4,13 @@ struct UserInfo: View {
@Environment(\.dismiss) private var dismiss
// Sample user data - replace with your actual data model
@State private var userName = "MeMo"
@State private var userName = ""
@State private var userEmail = "memo@example.com"
@State private var notificationsEnabled = true
@State private var darkModeEnabled = false
@State private var showLogoutAlert = false
@State private var avatarImage: UIImage? // Add this line
@State private var avatarImage: UIImage?
@State private var showUsername: Bool = false
var body: some View {
VStack(spacing: 0) {
@ -46,29 +47,47 @@ struct UserInfo: View {
Spacer()
VStack(spacing: 20) {
// Title
Text("Add Your Avatar")
Text(showUsername ? "Add Your Avatar" : "Whats Your Name")
.font(Typography.font(for: .body, family: .quicksandBold))
.frame(maxWidth: .infinity, alignment: .center)
// Avatar
ZStack {
AvatarPicker(selectedImage: $avatarImage)
AvatarPicker(
selectedImage: $avatarImage,
showUsername: $showUsername
)
}
.padding(.top, 20)
Button(action: {
// Action for second button
}) {
Text("Take a Photo")
if !showUsername {
Button(action: {
// Action for second button
}) {
Text("Take a Photo")
.font(Typography.font(for: .subtitle, family: .inter))
.fontWeight(.regular)
.frame(maxWidth: .infinity)
.padding()
.foregroundColor(.black)
.background(
RoundedRectangle(cornerRadius: 16)
.fill(Color.themePrimaryLight)
)
}
}
if showUsername {
TextField("Username", text: $userName)
.font(Typography.font(for: .subtitle, family: .inter))
.fontWeight(.regular)
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding()
.foregroundColor(.black)
.foregroundColor(.black)
.background(
RoundedRectangle(cornerRadius: 16)
.fill(Color.themePrimaryLight)
)
)
}
}
.padding()
@ -76,7 +95,7 @@ struct UserInfo: View {
.cornerRadius(20)
Spacer()
Button(action: {
// Action for next button
showUsername = true
}) {
Text("Continue")
.font(Typography.font(for: .body))