animation for the valid button

fix/answer-animation
Lucas DELANIER 1 year ago
parent 98270138fc
commit 12709c8e00

@ -14,6 +14,7 @@ struct ChoiceFinalAnswerCell: View {
var selected = false
var answer: AnswerDetail
var rawColor = AllInColors.blueAccentColor
var body: some View {
ZStack{
@ -27,6 +28,9 @@ struct ChoiceFinalAnswerCell: View {
Spacer()
OddCapsule(backgroundColor: selected ? .white : AllInColors.purpleAccentColor, foregroundColor: selected ? AllInColors.purpleAccentColor : .white ,odd: answer.odds ).padding(.trailing,20).scaleEffect(0.9)
}
}.background(selected ? AllInColors.purpleAccentColor : .white).cornerRadius(17)
}.background(selected ? AllInColors.purpleAccentColor : .white).cornerRadius(17).scaleEffect(selected ? 1.02 : 1).animation(
.easeInOut(duration: 0.3),
value: selected
)
}
}

@ -70,7 +70,7 @@ struct BetEndingValidation: View {
}
}
Spacer()
selectedAnswer != nil ? Button {
Button {
dismiss()
} label: {
Text("Valider")
@ -80,9 +80,10 @@ struct BetEndingValidation: View {
.frame(maxWidth: .infinity)
.padding(.vertical, 3)
}
.opacity(selectedAnswer != nil ? 1 : 0)
.animation(.easeInOut(duration: 0.3), value: selectedAnswer != nil)
.buttonStyle(.borderedProminent)
.tint(AllInColors.purpleAccentColor)
: nil
}
.padding([.all],20)
}

Loading…
Cancel
Save