...
var body: some View {
ZStack {
Rectangle().fill(Color.black).ignoresSafeArea(edges:Edge.Set.bottom)
List() {
ForEach(viewModel.list!) { item in
if item.index == 0 {
SettingRow(info: item)
.listRowSeparator(.hidden)
.listRowBackground(Color.clear)
.listRowInsets(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))
}else{
NavigationLink(destination: Text("测试")) {
SettingRow(info: item)
.listRowSeparator(.hidden)
.listRowBackground(Color.clear)
.listRowInsets(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10)).labelStyle(TitleOnlyLabelStyle())
}.listRowBackground(Color.clear).padding(0)
}
}
}.listStyle(PlainListStyle()).padding(.top,10)
}
}
...
enter image description here what happen?
If I didn't use NavigationLink, it worked fine, but once I joined it, the layout shifted a few pixels to the left and right. I tried adjusting the pad, but it didn't work. I didn't know what to do. I tried to upload the row width using ‘GeometryReader ‘and the display was normal. I think the ’label‘ was faulty. Is there a fixed offset? Anybody know?