Module 4, Lesson 9 Challenge Solution

//
//  ContentView.swift
//  Meal Picker
//
//  Created by Sam Grover on 15/06/22.
//

import SwiftUI

struct ContentView: View {
    @State var foodSelector = 3
    @State var locationSelector = 1
    @State var timeSelector = 1
    var body: some View {
        VStack{
            Spacer()
            Text("Ottimo Ristorante")
                .font(.largeTitle)
                .fontWeight(.bold)
            Spacer()
            HStack{
                Text("Location: ")
                    .font(.headline)
                Picker("Choose Location", selection: $locationSelector) {
                    Text("Bokaro").tag(1)
                    Text("Chatra").tag(2)
                    Text("Deoghar").tag(3)
                    Text("Tohana").tag(4)
                    Text("Hisar").tag(5)

                }.foregroundColor(.black)
            }
            Spacer()
            VStack(spacing: 0){
                Text("Order:")
                Picker("Order", selection: $foodSelector){
                    Text("Chicken Tikka").tag(1)
                    Text("Biryani").tag(2)
                    Text("Kadhai Paneer").tag(3)
                    Text("Dal Roti").tag(4)
                    Text("Kuch Nahi").tag(5)
                }.pickerStyle(WheelPickerStyle())
            }
            Spacer()
            VStack{
                Text("Pickup Time:")
                Picker("Time", selection: $timeSelector){
                    Text("5 PM").tag(1)
                    Text("6 PM").tag(2)
                    Text("7 PM").tag(3)
                    Text("8 PM").tag(4)
                    Text("9 PM").tag(5)
                }.pickerStyle(SegmentedPickerStyle())
            }
            Spacer()
            Button("Pick For me!") {
                foodSelector = Int.random(in: 1...5)
                timeSelector = Int.random(in: 1...5)
                locationSelector = Int.random(in: 1...5)
            }
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}