Skip to content

Commit 33e7e10

Browse files
fix: income/outcome widget UI (#73)
1 parent 49761fb commit 33e7e10

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

WidgetExtension/IncomeWidget/IncomeWidget.swift

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,33 @@ private struct IncomeWidgetEntryView: View {
5151
var entry: Provider.Entry
5252

5353
var body: some View {
54-
VStack {
55-
HStack(alignment: .firstTextBaseline, spacing: 4) {
54+
HStack {
55+
VStack {
5656
Text("\(Int(income))")
57-
.font(.callout)
58-
.padding(.leading, 16)
57+
.font(.system(size: 12))
58+
.padding(.top, 8)
5959

60-
Spacer()
60+
Bar(percent: income / self.maxValue, color: .green, width: 20)
6161

62-
Text("\(Int(expense))")
63-
.font(.callout)
64-
.padding(.trailing, 16)
62+
Text("Income")
63+
.padding(.bottom, 8)
6564
}
6665

67-
HStack {
68-
Bar(percent: income / self.maxValue, color: .green, width: 20)
66+
VStack {
67+
Text("\(Int(expense))")
68+
.font(.system(size: 12))
69+
.padding(.top, 8)
70+
6971
Bar(percent: expense / self.maxValue, color: .red, width: 20)
70-
}
71-
.background(Color.pink.opacity(0.1))
7272

73-
HStack {
74-
Text("Income")
75-
.padding(.leading, 8)
76-
Spacer()
7773
Text("Expense")
78-
.padding(.trailing, 8)
74+
.padding(.bottom, 8)
7975
}
8076
}
8177
.font(.footnote)
78+
.background(
79+
LinearGradient(gradient: Gradient(colors: [.white, .blue]), startPoint: .top, endPoint: .bottom)
80+
)
8281
}
8382

8483
private var income: Double {

0 commit comments

Comments
 (0)