Skip to content

Commit 01c95a6

Browse files
authored
ui: amountview remove navigation view
1 parent 98bcb0c commit 01c95a6

File tree

1 file changed

+59
-62
lines changed

1 file changed

+59
-62
lines changed

BDKSwiftExampleWallet/View/AmountView.swift

Lines changed: 59 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -15,77 +15,74 @@ struct AmountView: View {
1515

1616
var body: some View {
1717

18-
NavigationView {
19-
20-
ZStack {
21-
Color(uiColor: .systemBackground)
22-
23-
VStack(spacing: 50) {
24-
Spacer()
25-
VStack(spacing: 4) {
26-
Text("\(numpadAmount.formattedWithSeparator) sats")
27-
.textStyle(BitcoinTitle1())
28-
if let balance = viewModel.balanceTotal {
29-
HStack(spacing: 2) {
30-
Text(balance.delimiter)
31-
Text("total")
32-
}
33-
.fontWeight(.semibold)
34-
.font(.caption)
35-
.foregroundColor(.secondary)
36-
}
37-
if let balance = viewModel.balanceConfirmed {
38-
HStack(spacing: 2) {
39-
Text(balance.delimiter)
40-
Text("confirmed")
41-
}
42-
.fontWeight(.semibold)
43-
.font(.caption)
44-
.foregroundColor(.secondary)
18+
ZStack {
19+
Color(uiColor: .systemBackground)
20+
21+
VStack(spacing: 50) {
22+
Spacer()
23+
VStack(spacing: 4) {
24+
Text("\(numpadAmount.formattedWithSeparator) sats")
25+
.textStyle(BitcoinTitle1())
26+
if let balance = viewModel.balanceTotal {
27+
HStack(spacing: 2) {
28+
Text(balance.delimiter)
29+
Text("total")
4530
}
31+
.fontWeight(.semibold)
32+
.font(.caption)
33+
.foregroundColor(.secondary)
4634
}
47-
48-
GeometryReader { geometry in
49-
let buttonSize = geometry.size.width / 4
50-
VStack(spacing: buttonSize / 10) {
51-
numpadRow(["1", "2", "3"], buttonSize: buttonSize)
52-
numpadRow(["4", "5", "6"], buttonSize: buttonSize)
53-
numpadRow(["7", "8", "9"], buttonSize: buttonSize)
54-
numpadRow([" ", "0", "<"], buttonSize: buttonSize)
35+
if let balance = viewModel.balanceConfirmed {
36+
HStack(spacing: 2) {
37+
Text(balance.delimiter)
38+
Text("confirmed")
5539
}
56-
.frame(maxWidth: .infinity)
40+
.fontWeight(.semibold)
41+
.font(.caption)
42+
.foregroundColor(.secondary)
5743
}
58-
.frame(height: 300)
59-
60-
Spacer()
61-
62-
VStack {
63-
64-
Button {
65-
navigationPath.append(
66-
NavigationDestination.address(amount: numpadAmount)
67-
)
68-
} label: {
69-
Label(
70-
title: { Text("Next") },
71-
icon: { Image(systemName: "arrow.right") }
72-
)
73-
.labelStyle(.iconOnly)
74-
}
75-
.buttonStyle(BitcoinOutlined(width: 100, isCapsule: true))
44+
}
7645

46+
GeometryReader { geometry in
47+
let buttonSize = geometry.size.width / 4
48+
VStack(spacing: buttonSize / 10) {
49+
numpadRow(["1", "2", "3"], buttonSize: buttonSize)
50+
numpadRow(["4", "5", "6"], buttonSize: buttonSize)
51+
numpadRow(["7", "8", "9"], buttonSize: buttonSize)
52+
numpadRow([" ", "0", "<"], buttonSize: buttonSize)
7753
}
78-
54+
.frame(maxWidth: .infinity)
7955
}
80-
.padding()
81-
.task {
82-
viewModel.getBalance()
56+
.frame(height: 300)
57+
58+
Spacer()
59+
60+
VStack {
61+
62+
Button {
63+
navigationPath.append(
64+
NavigationDestination.address(amount: numpadAmount)
65+
)
66+
} label: {
67+
Label(
68+
title: { Text("Next") },
69+
icon: { Image(systemName: "arrow.right") }
70+
)
71+
.labelStyle(.iconOnly)
72+
}
73+
.buttonStyle(BitcoinOutlined(width: 100, isCapsule: true))
74+
8375
}
76+
8477
}
85-
.onChange(of: navigationPath) { oldPath, newPath in
86-
if newPath.isEmpty {
87-
numpadAmount = "0"
88-
}
78+
.padding()
79+
.task {
80+
viewModel.getBalance()
81+
}
82+
}
83+
.onChange(of: navigationPath) { oldPath, newPath in
84+
if newPath.isEmpty {
85+
numpadAmount = "0"
8986
}
9087
}
9188
.alert(isPresented: $viewModel.showingAmountViewErrorAlert) {

0 commit comments

Comments
 (0)