Skip to content

Commit

Permalink
Update UI
Browse files Browse the repository at this point in the history
  • Loading branch information
odeinjul committed Jul 29, 2023
1 parent 2390824 commit 02e0fdc
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.057",
"green" : "0.057",
"red" : "0.057"
"blue" : "0.132",
"green" : "0.132",
"red" : "0.132"
}
},
"idiom" : "universal"
Expand Down
38 changes: 38 additions & 0 deletions Pomodomo/Assets.xcassets/CardBackground.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.168",
"green" : "0.168",
"red" : "0.168"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
38 changes: 38 additions & 0 deletions Pomodomo/Assets.xcassets/ShadowGray.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.713",
"green" : "0.713",
"red" : "0.713"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.000",
"green" : "0.000",
"red" : "0.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
62 changes: 38 additions & 24 deletions Pomodomo/View/PomodomoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,41 @@ let musicData = NSDataAsset(name: "Ring")!.data
var audioPlayer: AVAudioPlayer?

struct PomodomoView: View {
@State private var backgroundColor = Color("BackgroundWhite")
@State private var backgroundColor = Color("CardBackground")

var body: some View {
ZStack {
VStack {
TimerView(colorChangeAction: { newColor in
self.changeBackgroundColor(newColor)
})
.padding(30)
.background(backgroundColor)
//.animation(.easeInOut, value: backgroundColor)
.cornerRadius(8)
.clipped()
.shadow(color: .gray.opacity(0.3), radius: 10)
ScrollView {
VStack (spacing: 40){
VStack (alignment: .leading, spacing: 5){
Text("Pomo")
.font(.title)
.fontWeight(.semibold)
Text("再早一点,再早一点进入摸鱼时间!")
.font(.system(size: 14, weight: .regular))
.foregroundColor(Color("TextGray"))
Spacer()
TimerView(colorChangeAction: { newColor in
self.changeBackgroundColor(newColor)
})
.padding(30)
.background(backgroundColor)
//.animation(.easeInOut, value: backgroundColor)
.cornerRadius(12)
.clipped()
.shadow(color: Color("ShadowGray").opacity(0.5), radius: 15)
}
.padding(.horizontal, 50)
StaticsView()
.padding(30)
.background(backgroundColor)
//.animation(.easeInOut, value: backgroundColor)
.cornerRadius(8)
.cornerRadius(12)
.clipped()
//.shadow(color: .gray.opacity(0.3), radius: 20)
.padding(.horizontal, 50)
.shadow(color: Color("ShadowGray").opacity(0.5), radius: 15)
}
.padding(.vertical, 30)
}
.padding(40)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color("BackgroundWhite"))
}
Expand Down Expand Up @@ -133,16 +144,17 @@ struct PomodomoTextView: View {

var body: some View {
VStack (spacing: 0) {
HStack {
HStack (spacing: 0) {
Text(pomodomoCurrent.type.simpleDescription())
.padding(.vertical, 2)
.padding(.horizontal, 6)
.foregroundColor(.white)
.font(.system(size: 15, weight: .medium))
.background(RoundedRectangle(cornerRadius: 5)
.fill(timerColor))
.foregroundColor(timerColor)
.font(.system(size: 20, weight: .black))
//.background(RoundedRectangle(cornerRadius: 5)
// .fill(timerColor))
//Divider()
Text("剩余时间")
.font(.system(size: 15, weight: .semibold))
.font(.system(size: 17, weight: .bold))
}
Text("\(secondsToHoursMinutesSeconds(Int(pomodomoCurrent.timeTotal - pomodomoCurrent.timePassed)))")
.onReceive(timer) { _ in
Expand All @@ -163,7 +175,7 @@ struct PomodomoTextView: View {
}
.font(.system(size: 55))
Text("(目标:25分钟)")
.font(.system(size: 13, weight: .regular))
.font(.system(size: 11, weight: .regular))
}
}
}
Expand All @@ -179,14 +191,16 @@ func NextPomo (pomodomoCurrent: Pomodomo, stop: inout Bool, colorChangeAction:
pomodomoCurrent.setType(.SmallRelax)
}
timerColor = pomodomoCurrent.color
withAnimation {
/*
withAnimation {
colorChangeAction(timerColor)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
withAnimation {
colorChangeAction(Color("BackgroundWhite"))
colorChangeAction(Color("CardBackground"))
}
}
*/

stop = true
}
Expand Down
2 changes: 2 additions & 0 deletions Pomodomo/View/StaticsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ struct StaticsCircleView: View {
.frame(width: 40, height: 40)
Text(weekDay)
.foregroundColor(Color("BackgroundWhite"))
.fontWeight(.semibold)
}
}
else {
Expand All @@ -157,6 +158,7 @@ struct StaticsCircleView: View {
.frame(width: 35, height: 35)
Text(weekDay)
.foregroundColor(Color("TextGray"))
.fontWeight(.semibold)
}
}
}
Expand Down

0 comments on commit 02e0fdc

Please sign in to comment.