From 12709c8e001cbae5db46a904938693574e8529ac Mon Sep 17 00:00:00 2001 From: ludelanier Date: Sat, 3 Feb 2024 17:49:00 +0100 Subject: [PATCH] animation for the valid button --- .../AllInApp/AllIn/Components/ChoiceFinalAnswerCell.swift | 6 +++++- Sources/AllInApp/AllIn/Views/BetEndingValidationView.swift | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Sources/AllInApp/AllIn/Components/ChoiceFinalAnswerCell.swift b/Sources/AllInApp/AllIn/Components/ChoiceFinalAnswerCell.swift index 8409cae..5665ea7 100644 --- a/Sources/AllInApp/AllIn/Components/ChoiceFinalAnswerCell.swift +++ b/Sources/AllInApp/AllIn/Components/ChoiceFinalAnswerCell.swift @@ -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 + ) } } diff --git a/Sources/AllInApp/AllIn/Views/BetEndingValidationView.swift b/Sources/AllInApp/AllIn/Views/BetEndingValidationView.swift index 7d84fad..db0c57b 100644 --- a/Sources/AllInApp/AllIn/Views/BetEndingValidationView.swift +++ b/Sources/AllInApp/AllIn/Views/BetEndingValidationView.swift @@ -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) } -- 2.36.3