Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from dnzxy/UI
Browse files Browse the repository at this point in the history
Add color gradient for dark scheme
  • Loading branch information
polscm32 authored Nov 19, 2023
2 parents 01c3de7 + cea7e7c commit e2f2182
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ struct MainChartView: View {
.scaleEffect(x: 1, y: -1)
.frame(width: fullGlucoseWidth(viewWidth: fullSize.width) + additionalWidth(viewWidth: fullSize.width))
.frame(maxHeight: Config.basalHeight)
.background(Color.clear)
.background(colorScheme == .dark ? Color.black.opacity(0.8) : Color.clear)
.onChange(of: tempBasals) { _ in
calculateBasalPoints(fullSize: fullSize)
}
Expand Down
37 changes: 24 additions & 13 deletions FreeAPS/Sources/Modules/Home/View/HomeRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,11 @@ extension Home {
}

@ViewBuilder private func bottomPanel(_: GeometryProxy) -> some View {
let colourRectangle: Color = colorScheme == .dark ? .gray.opacity(0.2) : .white
let colorRectangle: Color = colorScheme == .dark ? .black.opacity(0.8) : .white

ZStack {
Rectangle()
.fill(colourRectangle)
.fill(colorRectangle)
.frame(height: UIScreen.main.bounds.height / 13)
.cornerRadius(15)
.shadow(radius: 3)
Expand Down Expand Up @@ -627,21 +627,33 @@ extension Home {
}

var body: some View {
let colourBackground: Color = colorScheme == .dark ? .black.opacity(0.5) : .gray.opacity(0.1)
let colourChart: Color = colorScheme == .dark ? .gray.opacity(0.2) : .white
let colorBackground = colorScheme == .dark ? LinearGradient(
gradient: Gradient(colors: [
// RGB(3, 15, 28)
Color(red: 0.011, green: 0.058, blue: 0.109),
// RGB(1, 3, 8)
Color(red: 0.003, green: 0.011, blue: 0.031)
]),
startPoint: .top,
endPoint: .bottom
)
:
LinearGradient(gradient: Gradient(colors: [Color.gray.opacity(0.1)]), startPoint: .top, endPoint: .bottom)
let colourChart: Color = colorScheme == .dark ? .black.opacity(0.8) : .white

GeometryReader { geo in
VStack(spacing: 0) {
ZStack {
glucoseView
.padding(.top, 75)

loopView
/// circles width is 110, loops width is 35 -> (110/2) - (35/2) = 55 - 17.5 = 37.5
.offset(x: UIScreen.main.bounds.width * 0.43, y: -37.5)
.padding(.top, 75)
.padding(.trailing, 10)
}
.padding(.top, 75)

Spacer()

Spacer()

Expand All @@ -659,27 +671,26 @@ extension Home {
.overlay(mainChart)
.clipShape(RoundedRectangle(cornerRadius: 15))
.shadow(radius: 3)
.padding(.horizontal, 10)
.padding(10)
.frame(maxHeight: UIScreen.main.bounds.height / 2.2)

Spacer()

pickerPanel(geo)
//
Spacer()
.padding(.top, 13)

legendPanel
//

Spacer()

bottomPanel(geo)
//
}
.edgesIgnoringSafeArea(.vertical)
.background(colorBackground)
.edgesIgnoringSafeArea(.all)
}
.onAppear(perform: configureView)
.navigationTitle("Home")
.background(colourBackground)

.navigationBarHidden(true)
.ignoresSafeArea(.keyboard)
.popup(isPresented: isStatusPopupPresented, alignment: .top, direction: .top) {
Expand Down

0 comments on commit e2f2182

Please sign in to comment.