You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Apple/Sources/AllInApp/AllIn/Views/BetView.swift

78 lines
2.4 KiB

//
// BetView.swift
// AllIn
//
// Created by Lucas on 22/09/2023.
//
import SwiftUI
import Model
struct BetView: View {
@StateObject private var viewModel = BetViewModel()
@Binding var showMenu: Bool
@State var showingSheet: Bool = false
var body: some View {
VStack(alignment: .center, spacing: 0) {
TopBar(showMenu: self.$showMenu)
ScrollView(showsIndicators: false) {
LazyVStack(alignment: .leading, spacing: 0, pinnedViews: [.sectionHeaders]) {
TrendingBetCard().padding(.top,25).padding([.leading,.trailing],25)
Section {
VStack(spacing: 20){
ForEach(viewModel.bets, id: \.id) { (bet: Bet) in
BetCard(bet: bet)
}
Button("Show Sheet") {
showingSheet.toggle()
}
}
.padding([.leading,.trailing],25)
} header: {
ZStack{
AllInColors.fadeInGradiantCard
ScrollView(.horizontal,showsIndicators: false){
HStack{
ChoiceCapsule()
ChoiceCapsule()
ChoiceCapsule()
ChoiceCapsule()
ChoiceCapsule()
ChoiceCapsule()
ChoiceCapsule()
}
.padding(.leading,25)
.padding([.top,.bottom],15)
}
}
}
}
}
.refreshable {
viewModel.getItems()
}
.sheet(isPresented: $showingSheet) {
BetEndingValidation()
}
Spacer()
}
.edgesIgnoringSafeArea(.bottom)
.background(AllInColors.backgroundColor)
}
}
struct BetView_Previews: PreviewProvider {
static var previews: some View {
BetView(showMenu: .constant(false))
.preferredColorScheme(.light)
}
}