Darkpaw,
Code is too big to send in 1 text. I have to send 2.import SwiftUI
struct ContentView: View {
@State var tipa: [Double] = []
@State var costa: [Double] = []
@State private var cost = ""
@State private var paid = ""
@State var tipp = ""
@State var tipc = ""
@State var tipaa = ""
@State var totalcost = ""
@State var totaltips = ""
@State var totalcash = ""
@State var tipcc = ""
@State var numbc = ""
@State var number = 0
@State var msg = "Enter cost and how much was paid. Enter numbers and one . decimal point only. Then press enter."
@State var emsg = ""
var body: some View {
/* NavigationView {
VStack {
NavigationLink(destination: viewdetail()) {
Text("click")
.frame(width: 300, height: 150,
alignment: .center)
.background(Color.gray)
.foregroundColor(.black)
} } } */
ZStack
{
VStack
{
Text("Driver's Food Delivery")
.font(.largeTitle)
.fontWeight(.bold)
Spacer()
Text (msg)
Spacer()
Spacer()
HStack
{
Text("Cost")
.font(.largeTitle)
.padding(10)
Spacer()
Text("Paid")
.font(.largeTitle)
.padding(10)
Spacer()
Text("Tip")
.font(.title)
Spacer()
Text("Tip %")
.font(.title)
}
HStack
{
TextField("Cost", text: $cost)
.frame(width: 75, height: 25)
.padding(20)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.white)
.background(Color.brown)
.cornerRadius(025)
TextField("Paid", text: $paid)
.frame(width: 75, height: 25)
.padding(20)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.white)
.background(Color.brown)
.cornerRadius(025)
Text(tipp)
.frame(width: 75, height: 25)
.background(Color.blue)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.white)
Text(tipc)
.frame(width: 75, height: 5)
.padding(10)
.background(Color.blue)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.white)
}
VStack
{
Button { enterp()
}
label: { Text("Enter")
.font(.largeTitle)
.foregroundColor(.green ) }
Button {
print("detail pressed")
}
label: { Text("Detail")
.font(.largeTitle)
.foregroundColor(.white )
}
Button {print("delete pressed")
}
label: { Text("Delete")
.font(.largeTitle)
.foregroundColor(.red) }
}
VStack {
Spacer()
HStack
{
Spacer()
Text("Avg Tip")
.font(.title)
Spacer()
Text("Tip %")
.font(.title)
Spacer()
Text("#")
.font(.title)
Spacer()
}
HStack {
Spacer()
Spacer()
Spacer()
Text(tipaa)
.frame(width: 75, height: 25)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.white)
Spacer()
Spacer()
Text(tipcc)
.frame(width: 75, height: 5)
.padding(10)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.white)
Spacer()
Text(numbc)
.frame(width: 55, height: 5)
.padding(10)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.white)
Spacer()
}
}
VStack {
Spacer()
HStack
{
Text("Total")
.font(.title)
Spacer()
Text("Total")
.font(.title)
Spacer()
Text("Total")
.font(.title)
}
}
VStack {
HStack
{
Text("Cost")
.font(.title)
Spacer()
Text("Tips")
.font(.title)
Spacer()
Text("Cash")
.font(.title)
}
}
HStack {