77 lines
3.0 KiB
Swift
77 lines
3.0 KiB
Swift
//
|
|
// ExtExerciseList.swift
|
|
// Werkout_ios
|
|
//
|
|
// Created by Trey Tartt on 6/17/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ExtExerciseList: View {
|
|
var workout: Workout
|
|
var allSupersetExecerciseIndex: Int
|
|
|
|
var body: some View {
|
|
if let allSupersetExecercise = workout.allSupersetExecercise {
|
|
ZStack {
|
|
ScrollViewReader { proxy in
|
|
List() {
|
|
ForEach(allSupersetExecercise.indices, id: \.self) { supersetExecerciseIdx in
|
|
let supersetExecercise = allSupersetExecercise[supersetExecerciseIdx]
|
|
HStack {
|
|
if supersetExecerciseIdx == allSupersetExecerciseIndex {
|
|
Image(systemName: "figure.run")
|
|
.foregroundColor(Color("appColor"))
|
|
.font(Font.system(size: 55))
|
|
.minimumScaleFactor(0.01)
|
|
.lineLimit(1)
|
|
}
|
|
|
|
Text(supersetExecercise.exercise.name)
|
|
.font(Font.system(size: 55))
|
|
.minimumScaleFactor(0.01)
|
|
.lineLimit(3)
|
|
.padding()
|
|
|
|
Spacer()
|
|
}
|
|
.id(supersetExecerciseIdx)
|
|
}
|
|
}
|
|
.onChange(of: allSupersetExecerciseIndex, perform: { newValue in
|
|
withAnimation {
|
|
proxy.scrollTo(allSupersetExecerciseIndex, anchor: .top)
|
|
}
|
|
})
|
|
|
|
}
|
|
VStack {
|
|
Text("\(allSupersetExecerciseIndex+1)/\(workout.allSupersetExecercise?.count ?? 0)")
|
|
.font(Font.system(size: 55))
|
|
.minimumScaleFactor(0.01)
|
|
.lineLimit(1)
|
|
.padding()
|
|
.bold()
|
|
.foregroundColor(.white)
|
|
.background(
|
|
Capsule()
|
|
.strokeBorder(Color.black, lineWidth: 0.8)
|
|
.background(Color(uiColor: UIColor(red: 148/255,
|
|
green: 0,
|
|
blue: 211/255,
|
|
alpha: 0.5)))
|
|
.clipped()
|
|
)
|
|
.clipShape(Capsule())
|
|
|
|
Spacer()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//#Preview {
|
|
// ExtExerciseList()
|
|
//}
|