Change picker detail table list style?
Asked Answered
K

0

6

In SwiftUI, I'm using the default Picker like this:

Picker("Choose option", selection: $selectedRateID) {
    ForEach(model.rates, id: \.id) {
        Text($0.title).tag($0.id)
    }
}

The picker renders to this:

enter image description here

When I try to select an option, the detail screen looks like this:

enter image description here

Is there a way to make the picker options detail screen use the InsetGroupedListStyle like this:

enter image description here

I tried adding .listStyle(InsetGroupedListStyle()) to the ForEach, Picker, and other nodes, but it did not work. Any idea on how to achieve this? (And why is there so much space above it with no title?)

Krugersdorp answered 17/9, 2020 at 17:58 Comment(1)
You can try to create your own picker. The code from this answer will give you the expected result.Colosseum

© 2022 - 2024 — McMap. All rights reserved.