galimybių pasas

Home   »   galimybių pasas

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            ScrollView {
                VStack(alignment: .leading, spacing: 20) {
                    BannerView()
                        .padding()
                        .frame(maxWidth: .infinity)

                    HStack {
                        Spacer()
                        Image(uiImage: UIImage(named: "hello")!)
                            .resizable()
                            .frame(width: 120, height: 120)
                        Spacer()
                    }
                    VStack(alignment: .leading, spacing: 20) {
                        DetailView(label: "Vardas, pavardė", value: "Eimantas Vaičiūnas")
                        DetailView(label: "Gimimo metai", value: "1984")
                        HStack {
                            DetailView(label: "Išdavimo data", value: "2021-05-05")
                            DetailView(label: "Galioja iki", value: "2021-06-05")
                        }
                    }.frame(maxWidth: .infinity)
                }
            }
            Group {
                Button(
                    action: {},
                    label: {
                        Text("Atsisiųsti .PDF")
                            .padding()
                            .background(Color.black)
                            .foregroundColor(.white)
                            .cornerRadius(10)
                    }
                )
            }
            .frame(maxWidth: .infinity, maxHeight: 112)
            .background(Color.white)
        }.background(Color(UIColor(named:"BackgroundColor")!))
        .ignoresSafeArea()
    }
}

struct BannerView: View {
    var body: some View {
        HStack(spacing: 10) {
            Image(systemName: "checkmark").colorInvert()
                .padding()
                .background(Color(UIColor(named: "IconColor")!))
                .frame(width: 40, height: 40, alignment: .center)
                .cornerRadius(20)
            VStack(alignment: .leading) {
                Text("Žalias galimybių pasas").bold()
                Text("Kontaktinės veiklos leidžiamos").multilineTextAlignment(.leading)
            }
        }
        .padding()
        .frame(maxWidth: .infinity)
        .background(Color(UIColor(named: "BannerColor")!))
        .cornerRadius(10)

    }
}

struct DetailView: View {

    let label: String
    let value: String

    var body: some View {
        VStack(alignment: .leading) {
            Text(label).font(.caption)
            Text(value).bold()
        }
    }
}

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

Leave a Reply

Your email address will not be published. Required fields are marked *