Home > Blockchain >  Ignore safe area in safe area
Ignore safe area in safe area

Time:10-19

I'm trying to use Result

How do I make the green view ignore the bottom safe area so it touches the bottom?

CodePudding user response:

Once you spoke about keyboard you add another difficulty to your original question! I just made simple code with overlay method it can easily converted to ZStack method as well! You do which way you like! Also I just add some fun on green View just for show and need refactor for sure, but that is not the part of issue or question!

struct ContentView: View {
    
    @State private var string: String = String()
    
    var body: some View {
        
        let myDivider = Spacer().overlay(Color.secondary.frame(width: 1, height: 40))
        
        Color.clear
            .ignoresSafeArea(.all)
            .overlay(
                
                ScrollView {
                    
                    ZStack {
                        
                        LinearGradient(gradient: .init(colors: [.red, .blue]), startPoint: .top, endPoint: .bottom)
                            .frame(height: 1000)
                        
                        VStack {
                            
                            Spacer()
                            
                            TextField("Enter youer text here ...", text: $string)
                            
                            Spacer()
                            
                        }
                        
                    }
                    
                }
                
            )
            .overlay(
                Color.green
                    .overlay(HStack { Spacer(); Text("           
  • Related