美文网首页
xcode14 color.shadow(.inner(radi

xcode14 color.shadow(.inner(radi

作者: 王勋才 | 来源:发表于2022-06-08 21:21 被阅读0次
    IMG_2861.jpeg
    //
    //  ContentView.swift
    //  LearnSwiftUILesson
    //
    //  Created by 王勋才 on 2022/6/8.
    //苹果|应用|商店|搜|王勋才|有我全部作品
    
    
    import SwiftUI
    
    struct ContentView: View {
        @State private var showingSheet = false
        @State var width:CGFloat = 500
        @State var p:CGPoint = CGPoint(x: 0, y: 0)
        var body: some View {
           
          
                        HStack{
                            
                                ChessView(text: "1")
                                ChessView(text: "2",color: .orange)
                                ChessView(text: "3",color: .yellow)
                                ChessView(text: "4",color: .green)
                     
                        }
                        .frame(maxWidth: .infinity,maxHeight: .infinity)
                        .background(Color.indigo)
          
                
            
        }
    }
    
    
    
    
    
    struct ChessView: View {
        var text:String
        var color:Color = Color.red
        var body: some View {
            ZStack {
                Circle()
                    .fill(color.shadow(.inner(radius: 10)))
                    .frame(width: 200,height: 200)
                .shadow(radius: 10)
                
                Text(text)
                    .font(.system(size: 80))
                    .bold()
                    .foregroundColor(Color.white)
            }
        }
    }
    
    
    

    相关文章

      网友评论

          本文标题:xcode14 color.shadow(.inner(radi

          本文链接:https://www.haomeiwen.com/subject/egqpmrtx.html