Implement bank transfer app flows
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import SwiftUI
|
||||
|
||||
struct NumpadView: View {
|
||||
let onKey: (String) -> Void
|
||||
|
||||
private let rows: [[String]] = [
|
||||
["1", "2", "3"],
|
||||
["4", "5", "6"],
|
||||
["7", "8", "9"],
|
||||
["⌫", "0", "✓"]
|
||||
]
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 12) {
|
||||
ForEach(rows, id: \.self) { row in
|
||||
HStack(spacing: 20) {
|
||||
ForEach(row, id: \.self) { key in
|
||||
NumpadKey(label: key) { onKey(key) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct NumpadKey: View {
|
||||
let label: String
|
||||
let action: () -> Void
|
||||
|
||||
var isConfirm: Bool { label == "✓" }
|
||||
|
||||
var body: some View {
|
||||
Button(action: action) {
|
||||
Group {
|
||||
switch label {
|
||||
case "⌫":
|
||||
Image(systemName: "delete.left")
|
||||
.font(.system(size: 22))
|
||||
case "✓":
|
||||
Image(systemName: "checkmark")
|
||||
.font(.system(size: 22, weight: .semibold))
|
||||
default:
|
||||
Text(label)
|
||||
.font(.system(size: 28, weight: .light))
|
||||
}
|
||||
}
|
||||
.frame(width: 72, height: 72)
|
||||
.background(isConfirm ? Color.accentColor : Color(.systemFill))
|
||||
.foregroundStyle(isConfirm ? .white : .primary)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NumpadView { _ in }
|
||||
}
|
||||
Reference in New Issue
Block a user