As Benzy Neez said, adding chart to Section
.header
and using .listRowInsets
to snap to edges works fine.
List {
Section {
} header: {
ZStack {
Color.white
BasicHealthRangeCharts(samples: viewModel.healthData.compactMap(ChartHealthSample.init(from:)))
.padding(.horizontal)
}
}
.listRowInsets(EdgeInsets(top: 0, leading: -32, bottom: 0, trailing: -32))
Section {
Button {
viewModel.onPinButton()
} label: {
Text(viewModel.isPinned ? "Unpin from summary" : "Pin in summary")
.foregroundColor(.primary)
.padding()
}
} header: {
Text("Options")
.padding(.vertical, 16)
}
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 16))
.headerProminence(.increased)
Section {
NavigationLink {
PetHealthAllDataView(dataType: viewModel.type, data: viewModel.healthData)
} label: {
Text("Show all data")
}
}
}