This commit is contained in:
Daniel Arantes Loverde
2026-06-03 14:31:11 -03:00
parent 69dd67b8a5
commit 74848192a0
28 changed files with 134 additions and 617 deletions

View File

@@ -15,23 +15,13 @@ struct LoginView: View {
@State var lastAnimatedToken = 0
@ViewBuilder private var logoImage: some View {
#if os(Android)
SwiftUI.Image("pedifoods", bundle: .module)
.resizable()
#else
SwiftUI.Image("pedifoods")
.resizable()
#endif
}
@ViewBuilder private var pinHeroImage: some View {
#if os(Android)
SwiftUI.Image(colorScheme == .dark ? "pin_image_app_dark" : "pin_image_app", bundle: .module)
.resizable()
#else
SwiftUI.Image("pin_image_app")
.resizable()
#endif
}
var body: some View {
@@ -43,13 +33,6 @@ struct LoginView: View {
(colorScheme == .dark ? Color.black : AppColors.backgroundLight)
.ignoresSafeArea()
#if os(Android)
pinHeroImage
.scaledToFill()
.frame(height: heroHeight + 80)
.offset(y: heroVisible ? -60 : -(heroHeight + 220))
.opacity(colorScheme == .dark ? 0.08 : 0.15)
#else
pinHeroImage
.scaledToFill()
.frame(height: heroHeight + 80)
@@ -61,7 +44,6 @@ struct LoginView: View {
endPoint: .bottom
)
)
#endif
VStack(spacing: 18) {
Spacer().frame(height: logoTopInset)
@@ -90,6 +72,7 @@ struct LoginView: View {
.tint(AppColors.tertiary)
.offset(y: buttonVisible ? 0 : 140)
.opacity(buttonVisible ? 1.0 : 0.0)
.buttonStyle(.plain)
HStack(spacing: 6) {
Text("Não tem conta ainda?")
@@ -97,6 +80,7 @@ struct LoginView: View {
Button("Criar conta") {
navigate(.registration)
}
.buttonStyle(.plain)
.foregroundStyle(AppColors.primary)
}
.font(AppTypography.body)
@@ -108,36 +92,15 @@ struct LoginView: View {
}
.ignoresSafeArea()
.onAppear {
#if os(Android)
// No Android, rodamos a animação localmente de forma direta
applyHiddenStateWithoutAnimation()
Task {
try? await Task.sleep(nanoseconds: 100_000_000)
withAnimation(.easeOut(duration: 0.5)) {
heroVisible = true
}
try? await Task.sleep(nanoseconds: 150_000_000)
withAnimation(.easeOut(duration: 0.4)) {
textVisible = true
}
try? await Task.sleep(nanoseconds: 150_000_000)
withAnimation(.easeOut(duration: 0.4)) {
buttonVisible = true
}
}
#else
if shouldPrepareEntryAnimation {
applyHiddenStateWithoutAnimation()
} else {
showFinalStateWithoutAnimation()
}
#endif
}
#if os(iOS)
.task(id: authEntryAnimationToken) {
await runEntryAnimationIfNeeded(for: authEntryAnimationToken)
}
#endif
}
}