initial start screen

Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
Matt Bruce 2024-12-20 13:19:36 -06:00
parent d8a34ad1ce
commit 9b0287f038
6 changed files with 191 additions and 1 deletions

View File

@ -13,7 +13,7 @@ struct ContentView: View {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
Text("Fitness App!")
}
.padding()
}

View File

@ -0,0 +1,42 @@
//
// FitnessTabView.swift
// FitnessApp
//
// Created by Matt Bruce on 12/20/24.
//
import SwiftUI
struct FitnessTabView: View {
@State var selectedTab = "Home"
init() {
let appearace = UITabBarAppearance()
appearace.configureWithOpaqueBackground()
appearace.stackedLayoutAppearance.selected.iconColor = .green
appearace.stackedLayoutAppearance.selected.titleTextAttributes =
[.foregroundColor: UIColor.label]
UITabBar.appearance().scrollEdgeAppearance = appearace
}
var body: some View {
TabView(selection: $selectedTab) {
HomeView()
.tag("Home")
.tabItem {
Image(systemName: "house")
Text("Home")
}
HistoricDataView()
.tag("Historic")
.tabItem {
Image(systemName: "chart.line.uptrend.xyaxis")
Text("Historic")
}
}
}
}
#Preview {
FitnessTabView()
}

View File

@ -0,0 +1,18 @@
//
// HistoricDataView.swift
// FitnessApp
//
// Created by Matt Bruce on 12/20/24.
//
import SwiftUI
struct HistoricDataView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
#Preview {
HistoricDataView()
}

82
FitnessApp/HomeView.swift Normal file
View File

@ -0,0 +1,82 @@
//
// 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 body: some View {
ScrollView(showsIndicators: false) {
VStack {
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()
}
}
}
}
#Preview {
HomeView()
}

View File

@ -0,0 +1,17 @@
//
// ProfileView.swift
// FitnessApp
//
// Created by Matt Bruce on 12/20/24.
//
import SwiftUI
struct ProfileView: View {
var body: some View {
Text("Profile")
}
}
#Preview {
HomeView()
}

View File

@ -0,0 +1,31 @@
//
// ProgressCircle.swift
// FitnessApp
//
// Created by Matt Bruce on 12/20/24.
//
import SwiftUI
struct ProgressCircleView: View {
@Binding var progress: Int
var goal: Int
var color: Color
private let width: CGFloat = 20
var body: some View {
ZStack {
Circle()
.stroke(color.opacity(0.3), lineWidth: width)
Circle()
.trim(from: 0, to: CGFloat(progress) / CGFloat(goal))
.stroke(color, style: StrokeStyle(lineWidth: 20, lineCap: .round))
.rotationEffect(Angle(degrees: -90))
.shadow(radius: 5)
}
}
}
#Preview {
ProgressCircleView(progress: .constant(100), goal: 200, color: .gray)
}