This commit is contained in:
Daniel Arantes Loverde
2026-02-15 08:18:06 -03:00
parent d7b8b1864a
commit 0f5ad4c268
35 changed files with 4090 additions and 309 deletions

View File

@@ -32,7 +32,7 @@ struct MainTabView: View {
private var customTabBar: some View {
HStack(spacing: 12) {
tabBarButton(tab: .home, title: "Home", icon: "house.fill")
tabBarButton(tab: .cart, title: "Carrinho", icon: "cart.fill")
tabBarButton(tab: .cart, title: "Carrinho", icon: "cart.fill", badgeCount: appState.cart.totalItems)
tabBarButton(tab: .profile, title: "Perfil", icon: "person.fill")
}
.padding(.horizontal, 14)
@@ -46,14 +46,27 @@ struct MainTabView: View {
.shadow(color: AppShadow.soft.color, radius: AppShadow.soft.radius, y: AppShadow.soft.y)
}
private func tabBarButton(tab: MainTab, title: String, icon: String) -> some View {
private func tabBarButton(tab: MainTab, title: String, icon: String, badgeCount: Int = 0) -> some View {
let isActive = selectedTab == tab
return Button {
selectedTab = tab
} label: {
HStack(spacing: 8) {
Image(systemName: icon)
.font(.system(size: 18, weight: .semibold))
ZStack(alignment: .topTrailing) {
Image(systemName: icon)
.font(.system(size: 18, weight: .semibold))
if badgeCount > 0 {
Text("\(min(badgeCount, 99))")
.font(.system(size: 9, weight: .bold))
.foregroundStyle(Color.white)
.padding(.horizontal, 4)
.padding(.vertical, 2)
.background(Color.red)
.clipShape(Capsule())
.offset(x: 9, y: -8)
}
}
if isActive {
Text(title)
.font(AppTypography.heading3)