WheelPicker

@Composable
fun WheelPicker(count: Int, getItemText: (Int) -> String, modifier: Modifier = Modifier, itemHeight: Dp = WheelPickerDefaults.DefaultItemHeight, itemMargin: Dp = WheelPickerDefaults.defaultItemMargin, rowNumber: Int = 7, onSelectedChange: (Int) -> Unit? = null, colors: WheelPickerColors = WheelPickerDefaults.wheelPickerColors(), initialSelectedIndex: Int = rowNumber / 2, indicatorBackgroundShape: Shape = WheelPickerDefaults.DefaultIndicatorShape, indicatorCenterTextStyle: TextStyle = PicoTheme.typography.headlineLarge, isInfinite: Boolean = false, leftText: @Composable () -> Unit? = null, rightText: @Composable () -> Unit? = null, state: LazyListState = with(count) { check(this > 0) { "count must lager than 0" } rememberWheelState( count, rowNumber, initialFirstVisibleItemIndex = initialSelectedIndex % this, ) })

A common picker widget defined by PICO Design.

Parameters

count

The items count.

getItemText

Returns the text based on the given index.

modifier

The Modifier used by the WheelPicker.

itemHeight

The height of picker's item.

itemMargin

The margin of picker's item.

rowNumber

The number of visible rows.

onSelectedChange

Will be called with the current selected index when scrolling finished.

colors

A WheelPickerColors to customize the appearance of pickers.

initialSelectedIndex

The initial selected item index, default is rowNumber/2.

indicatorBackgroundShape

The indicator's background shape.

indicatorCenterTextStyle

The TextStyle used by the indicator to draw text.

isInfinite

Whether the list can scroll infinitely.

leftText

The text will show at left of indicator center text.

rightText

The text will show at right of indicator center text.

state

The state object to be used to control or observe the list's state. See also rememberWheelState.


@Composable
fun WheelPicker(count: Int, getItemText: (Int) -> String, modifier: Modifier = Modifier, itemHeight: Dp = WheelPickerDefaults.DefaultItemHeight, itemMargin: Dp = WheelPickerDefaults.defaultItemMargin, rowNumber: Int = 7, onSelectedChange: (Int) -> Unit? = null, colors: WheelPickerColors = WheelPickerDefaults.wheelPickerColors(), vibrants: WheelPickerVibrants = WheelPickerDefaults.wheelPickerVibrants(), initialSelectedIndex: Int = rowNumber / 2, indicatorBackgroundShape: Shape = WheelPickerDefaults.DefaultIndicatorShape, indicatorCenterTextStyle: TextStyle = PicoTheme.typography.headlineLarge, isInfinite: Boolean = false, leftText: @Composable () -> Unit? = null, rightText: @Composable () -> Unit? = null, state: LazyListState = with(count) { check(this > 0) { "count must lager than 0" } rememberWheelState( count, rowNumber, initialFirstVisibleItemIndex = initialSelectedIndex % this, ) })

A common picker widget defined by PICO Design.

Parameters

count

The items count.

getItemText

Returns the text based on the given index.

modifier

The Modifier used by the WheelPicker.

itemHeight

The height of picker's item.

itemMargin

The margin of picker's item.

rowNumber

The number of visible rows.

onSelectedChange

Will be called with the current selected index when scrolling finished.

colors

A WheelPickerColors to customize the appearance of pickers.

vibrants

The WheelPickerVibrants to customize the appearance of pickers.

initialSelectedIndex

The initial selected item index, default is rowNumber/2.

indicatorBackgroundShape

The indicator's background shape.

indicatorCenterTextStyle

The TextStyle used by the indicator to draw text.

isInfinite

Whether the list can scroll infinitely.

leftText

The text will show at left of indicator center text.

rightText

The text will show at right of indicator center text.

state

The state object to be used to control or observe the list's state. See also rememberWheelState.