Home > AI > IOS > SwiftUI >

listRowInsets(_:)

Example :

struct ContentView: View {

    var body: some View {
        List {
            Text("strawberry")
                .listRowBackground(Color.green)
            
            Text("vanilla")
                .padding(EdgeInsets.init(top: 0,
                                         leading: 0,
                                         bottom: 0,
                                         trailing: 0))
                .listRowBackground(Color.blue)
                
            Text("chocolate")
                .listRowInsets(.init(top: 0,
                                     leading: 0,
                                     bottom: 0,
                                     trailing: 0))
                .listRowBackground(Color.orange)
            
            Text("almond")
                .listRowInsets(.init(top: 0,
                                     leading: 35,
                                     bottom: 0,
                                     trailing: 0))
                .listRowBackground(Color.purple)
       
        }
    }
}

Leave a Reply