115 lines
3.8 KiB
Swift
115 lines
3.8 KiB
Swift
//
|
|
// HomeView.swift
|
|
// FitnessApp
|
|
//
|
|
// Created by Matt Bruce on 12/20/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct HomeView: View {
|
|
@State var calories: Int = 123
|
|
@State var active: Int = 205
|
|
@State var stand: Int = 80
|
|
|
|
var mockActivities = [
|
|
Activity(id: 0, title: "Today Steps", subtitle: "10,000 steps", image: "figure.walk", tintColor: .green, amount: "9,812"),
|
|
Activity(id: 1, title: "Today Steps", subtitle: "1,000 steps", image: "figure.walk", tintColor: .blue, amount: "812"),
|
|
Activity(id: 2, title: "Today Steps", subtitle: "12,000 steps", image: "figure.walk", tintColor: .purple, amount: "9,0000"),
|
|
Activity(id: 3, title: "Today Steps", subtitle: "50,000 steps", image: "figure.run", tintColor: .red, amount: "104,812")
|
|
]
|
|
|
|
var body: some View {
|
|
ScrollView(showsIndicators: false) {
|
|
VStack(alignment: .leading) {
|
|
Text("Wecome")
|
|
.font(.largeTitle)
|
|
.padding()
|
|
|
|
HStack {
|
|
|
|
Spacer()
|
|
|
|
VStack {
|
|
|
|
VStack {
|
|
Text("Calories")
|
|
.font(.callout)
|
|
.bold()
|
|
.foregroundColor(.red)
|
|
|
|
Text("123 kcal")
|
|
.bold()
|
|
}.padding(.bottom)
|
|
|
|
VStack {
|
|
Text("Active")
|
|
.font(.callout)
|
|
.bold()
|
|
.foregroundColor(.green)
|
|
|
|
Text("52 mins")
|
|
.bold()
|
|
}.padding(.bottom)
|
|
|
|
|
|
VStack {
|
|
Text("Stand")
|
|
.font(.callout)
|
|
.bold()
|
|
.foregroundColor(.blue)
|
|
|
|
Text("8 hrs")
|
|
.bold()
|
|
}
|
|
|
|
}
|
|
|
|
Spacer()
|
|
|
|
ZStack {
|
|
Spacer()
|
|
ProgressCircleView(progress: $calories, goal: 600, color: .red)
|
|
ProgressCircleView(progress: $active, goal: 600, color: .green).padding(.all, 20)
|
|
ProgressCircleView(progress: $stand, goal: 600, color: .blue).padding(.all, 40)
|
|
}
|
|
.padding(.horizontal)
|
|
|
|
Spacer()
|
|
}
|
|
.padding()
|
|
|
|
//Fitness Activity
|
|
HStack {
|
|
Text("Fitness Activity")
|
|
.font(.title2)
|
|
|
|
Spacer()
|
|
|
|
Button {
|
|
print("Show More")
|
|
} label: {
|
|
Text("Show More")
|
|
.padding(.all, 10)
|
|
.foregroundColor(.white)
|
|
.background(.blue)
|
|
.cornerRadius(20)
|
|
}
|
|
}
|
|
|
|
LazyVGrid(columns: Array(repeating: GridItem(spacing: 20), count: 2)) {
|
|
ForEach(mockActivities, id: \.id) { activity in
|
|
ActivityCard(activity: activity)
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
HomeView()
|
|
}
|