I have an HStack and it looks like there is some small area above it (white area above the red one) that is kind of not covered by the background. The color of it stays the same no matter which one I use. In dark mode, this area uses the color of the background and that is why not visible but can be detected in debug view.
var body: some View {
NavigationView {
VStack {
Form {
ForEach(sections) { section in
Section {
PricesFilterMenuSectionView(items: section.items)
} header: {
Text(section.translation)
.font(.title3.weight(.bold))
.foregroundColor(.primary)
.textCase(nil)
} footer: {
if section != sections.last {
VStack(spacing: 0) {
Divider().padding(.top, Layout.dividerTopPadding)
}
}
}
}
}
.navigationBarTitle(Text(title), displayMode: .inline)
.navigationBarItems(leading: Button(action: dismissAction, label: { Image(systemName: "xmark").foregroundColor(.primary) }))
/////// This HStack
HStack {
Button(action: {
sections.forEach { section in
section.items.forEach { item in
item.isSelected = false
}
}
}, label: {
Text("clear_filters".localized).foregroundColor(ThemeManager.current.secondaryColor.color)
})
Spacer()
Button {
let tags = sections.flatMap { section in
section.items.compactMap { item -> Int? in
item.isSelected ? item.id : nil
}
}
showAction(tags)
} label: {
Text("show_results".localized)
}
.buttonStyle(PrimaryButtonStyle())
}
.padding(.horizontal, Layout.ctaStackHorizontalPadding)
.padding(.top)
.background((colorScheme == .dark ? Color(UIColor.red) : Color.red).ignoresSafeArea())
.compositingGroup()
// .shadow(color: colorScheme == .dark ? .black : .gray, radius: 15, x: 0, y: 0)
}
}
}
CodePudding user response:
At the line after NavigationView {
Change this:
VStack {
to this:
VStack(spacing: 0) {