I'm trying to align these two login buttons, I use the same design method to them but found their alignment are different.
VStack(spacing: 15) {
//https://stackoverflow.com/questions/58048831/add-text-and-image-to-button-in-swiftui button with image and text inset
Button(action: {
loginWithWechat()
}) {
HStack {
//https://stackoverflow.com/questions/56505692/how-to-resize-image-with-swiftui resize image
Image("wechat").resizable().frame(width: 22.9, height: 20)
Text("Login With Wechat").bold()
}
}
.padding()
.foregroundColor(.white)
.background(Color.black)
.cornerRadius(.infinity)
.frame(width: 300, height: 50)
.overlay(content: {
RoundedRectangle(cornerRadius: .infinity).stroke(Color.white, lineWidth: 3)
})
Button(action: {
loginWithGoogle()
}) {
HStack {
Image("google").resizable().frame(width: 20, height: 20)
Text("Login With Google").bold()
}
}
.padding()
.foregroundColor(.black)
.background(Color.white)
.cornerRadius(.infinity)
.frame(width: 300, height: 50)
.overlay(content: {
RoundedRectangle(cornerRadius: .infinity).stroke(Color.black, lineWidth: 3)
})
}
And test it like
Could anyone help me find out the problem and give me some suggestions?