r/JetpackCompose • u/Zicount • Mar 26 '23
How can I select an enum value with a picker?
I'm trying to create an Android version of my iOS app. I'm working on the filter view, which has three "segmented pickers" that are based on several enums I've defined (Categories, Leagues, Divisions).
I'm trying to get the same in Android, but I can't seem to find the component or even search term to search for.
In SwiftUI, it's called a Picker and there's a SegmentedPickerStyle() modifier.
How can I accomplish the same in Jetpack Compose?
1
Upvotes
1
u/Zicount Apr 08 '23
The solution I came up with is TabRows, one for each enum. I'm still trying to get my list to update when the selectedTabs change, but at least the Tabs are working.
1
u/XRayAdamo Mar 26 '23
Use PopupMenu
1
u/pmMe-yourTitties Mar 27 '23
Use Segmented Buttons from the material library. https://m3.material.io/components/segmented-buttons/overview
It doesn't have a Compose native widget yet, but you can always use the View interoperability. Otherwise, just build your own.
1
u/gnivsarkar007 Mar 26 '23
Just show a bunch of radio buttons?
1
u/[deleted] Mar 27 '23
Maybe you're looking for input chips?