fix button problem

dev_ARKit^2
Rayhân HASSOU 10 months ago
parent d3884adda3
commit 2f8b6b92b9

@ -25,24 +25,25 @@ struct MainMenuButton: View {
var bottomRightCorner: CGFloat = 0
var body: some View {
Button(text.uppercased()) {
//playSound(named: sound)
if let onClick: () -> Void {
onClick()
}
Button(action: {
// playSound(named: sound)
onClick?()
}) {
Text(text.uppercased())
.font(.headline)
.fontWeight(.semibold)
.foregroundColor(.white)
.padding()
.frame(maxWidth: .infinity, maxHeight: 40)
.background(
Color.red
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 0, height: 0)))
.mask(RoundedCornersShape(cornerRadii: (topLeft: topLeftCorner, topRight: topRightCorner, bottomLeft: bottomLeftCorner, bottomRight: bottomRightCorner)))
)
.frame(width: UIScreen.main.bounds.width / 1.7)
.frame(maxWidth: .infinity, alignment: horizontalAlignment)
}
.font(.headline)
.fontWeight(.semibold)
.foregroundColor(.white)
.padding()
.frame(maxWidth: .infinity, maxHeight: 40)
.background(
Color.red
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 0, height: 0)))
.mask(RoundedCornersShape(cornerRadii: (topLeft: topLeftCorner, topRight: topRightCorner, bottomLeft: bottomLeftCorner, bottomRight: bottomRightCorner)))
)
.frame(width: UIScreen.main.bounds.width / 1.7)
.frame(maxWidth: .infinity, alignment: horizontalAlignment)
.buttonStyle(PlainButtonStyle())
}
}

Loading…
Cancel
Save