I want to remove the empty space below list element. Height has to be dynamic for list rows. If I remove the list, then the content will start from the bottom.
Here is code:
var body: some View {
VStack{
Spacer()
HStack{
Text(orderDetails.orderNumber ?? "").bold()
Spacer()
}
List{
Section(header: ListHeader()) {
ForEach(paidDetails.indices,id:\.self) { i in
HStack {
Text("Paid By:")
Spacer()
Text(paidDetails[i].name ?? "")
Spacer()
Text((paidDetails[i].amountCollected))
}
}
}
}
Button(action: {
presentationMode.wrappedValue.dismiss()
}, label: {
Text("Close".localized).bold()
})
.background(Color("CallCustomerBG"))
}
}
}
You can add that button to the section footer like so:
Section(header: ListHeader(), footer: {
Button(action: {
presentationMode.wrappedValue.dismiss()
}, label: {
Text("Close".localized).bold()
})
.background(Color("CallCustomerBG"))
}) {
ForEach(paidDetails.indices,id:\.self) { i in
HStack {
Text("Paid By:")
Spacer()
Text(paidDetails[i].name ?? "")
Spacer()
Text((paidDetails[i].amountCollected))
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.