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> <key>wake.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>3</integer> <integer>0</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>

View File

@ -23,7 +23,7 @@
<key>UIAppFonts</key> <key>UIAppFonts</key>
<array> <array>
<string>Inter.ttf</string> <string>Inter.ttf</string>
<string>Quicksand X.ttf</string> <string>Quicksand x.ttf</string>
<string>Quicksand-Regular.ttf</string> <string>Quicksand-Regular.ttf</string>
<string>Quicksand-Bold.ttf</string> <string>Quicksand-Bold.ttf</string>
<string>Quicksand-SemiBold.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 showMediaPicker = false
@State private var isUploading = false @State private var isUploading = false
@Binding var selectedImage: UIImage? @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._selectedImage = selectedImage
self._showUsername = showUsername
} }
public var body: some View { public var body: some View {
@ -37,7 +39,7 @@ public struct AvatarPicker: View {
} }
} }
} }
if !showUsername {
// Upload button // Upload button
Button(action: { Button(action: {
showMediaPicker = true showMediaPicker = true
@ -53,7 +55,9 @@ public struct AvatarPicker: View {
.fill(Color.themePrimaryLight) .fill(Color.themePrimaryLight)
) )
} }
.frame(width: .infinity) .frame(maxWidth: .infinity)
}
} }
.sheet(isPresented: $showMediaPicker) { .sheet(isPresented: $showMediaPicker) {
MediaPicker( MediaPicker(

View File

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