PickerGroup
Composable Component
A group of Picker
s to build components where multiple pickers are required to be combined
together. The component maintains the focus between different Picker
s by using
PickerGroupState
. It can be handled from outside the component using the same instance and its
properties. When touch exploration services are enabled, the focus moves to the picker which is
clicked. To handle clicks in a different manner, use the onSelected
lambda to control the focus
of talkback and actual focus.
Android
@Composable
public fun PickerGroup(
vararg pickers: PickerGroupItem,
modifier: Modifier = Modifier,
pickerGroupState: PickerGroupState = rememberPickerGroupState(),
onSelected: (selectedIndex: Int) -> Unit = {},
autoCenter: Boolean = true,
propagateMinConstraints: Boolean = false,
touchExplorationStateProvider: TouchExplorationStateProvider =
DefaultTouchExplorationStateProvider(),
separator: (@Composable (Int) -> Unit)? = null,
)
Parameters
pickers | List of Picker s represented using PickerGroupItem in the same order of display from left to right. |
modifier | Modifier to be applied to the PickerGroup |
pickerGroupState | The state of the component |
onSelected | Action triggered when one of the Picker is selected inside the group |
autoCenter | Indicates whether the selected Picker should be centered on the screen. It is recommended to set this as true when all the pickers cannot be fit into the screen. Or provide a mechanism to navigate to pickers which are not visible on screen. If false, the whole row containing pickers would be centered. |
propagateMinConstraints | Whether the incoming min constraints should be passed to content. |
touchExplorationStateProvider | A TouchExplorationStateProvider to provide the current state of touch exploration service. This will be used to determine how the PickerGroup and talkback focus behaves/reacts to click and scroll events. |
separator | A composable block which describes the separator between different Picker s. The integer parameter to the composable depicts the index where it will be kept. For example, 0 would represent the separator between the first and second picker. |