ShuffleButton

Functions summary

Unit
@UnstableApi
@Composable
ShuffleButton(
    player: Player?,
    modifier: Modifier,
    imageVector: ShuffleButtonState.() -> ImageVector,
    contentDescription: @Composable ShuffleButtonState.() -> String,
    colors: IconButtonColors,
    tint: Color,
    onClick: ShuffleButtonState.() -> Unit
)

A Material3 IconButton that toggles the shuffle mode of the player.

Unit
@UnstableApi
@Composable
ShuffleButton(
    player: Player?,
    modifier: Modifier,
    painter: @Composable ShuffleButtonState.() -> Painter,
    contentDescription: @Composable ShuffleButtonState.() -> String,
    colors: IconButtonColors,
    tint: Color,
    onClick: ShuffleButtonState.() -> Unit
)

A Material3 IconButton that toggles the shuffle mode of the player.

Functions

@UnstableApi
@Composable
fun ShuffleButton(
    player: Player?,
    modifier: Modifier = Modifier,
    imageVector: ShuffleButtonState.() -> ImageVector,
    contentDescription: @Composable ShuffleButtonState.() -> String = defaultShuffleContentDescription,
    colors: IconButtonColors = IconButtonDefaults.iconButtonColors(),
    tint: Color = Color.Unspecified,
    onClick: ShuffleButtonState.() -> Unit = ShuffleButtonState::onClick
): Unit

A Material3 IconButton that toggles the shuffle mode of the player.

When clicked, it enables or disables the player's shuffle mode. The button's state (e.g., whether it's enabled and the shuffle icon) is managed by a ShuffleButtonState instance derived from the provided player.

Parameters
player: Player?

The Player to control.

modifier: Modifier = Modifier

The Modifier to be applied to the button.

imageVector: ShuffleButtonState.() -> ImageVector

The supplier for ImageVector used for the icon displayed on the button. This is a composable lambda with ShuffleButtonState as its receiver, allowing the icon to be updated based on the button's current state (e.g. ShuffleButtonState.shuffleOn).

contentDescription: @Composable ShuffleButtonState.() -> String = defaultShuffleContentDescription

The content description for accessibility purposes.

colors: IconButtonColors = IconButtonDefaults.iconButtonColors()

IconButtonColors that will be used to resolve the colors used for this icon button in different states. See IconButtonDefaults.iconButtonColors.

tint: Color = Color.Unspecified

Tint to be applied to imageVector. If Color.Unspecified is provided, then no tint is applied.

onClick: ShuffleButtonState.() -> Unit = ShuffleButtonState::onClick

The action to be performed when the button is clicked. This lambda has ShuffleButtonState as its receiver, providing access to the button's current state (e.g., ShuffleButtonState.isEnabled). The default behavior is to call ShuffleButtonState.onClick, which toggles the player's shuffle mode. Consumers can customize this behavior:

  • To add custom logic while still performing the default action, call this.onClick() within your lambda.

  • To completely override the default behavior, implement your custom logic without calling this.onClick(). Note that in this case, the button might still be enabled based on the player state, so ensure your custom logic handles cases where modifying the shuffle mode is not possible.

@UnstableApi
@Composable
fun ShuffleButton(
    player: Player?,
    modifier: Modifier = Modifier,
    painter: @Composable ShuffleButtonState.() -> Painter = defaultShufflePainterIcon,
    contentDescription: @Composable ShuffleButtonState.() -> String = defaultShuffleContentDescription,
    colors: IconButtonColors = IconButtonDefaults.iconButtonColors(),
    tint: Color = Color.Unspecified,
    onClick: ShuffleButtonState.() -> Unit = ShuffleButtonState::onClick
): Unit

A Material3 IconButton that toggles the shuffle mode of the player.

When clicked, it enables or disables the player's shuffle mode. The button's state (e.g., whether it's enabled and the shuffle icon) is managed by a ShuffleButtonState instance derived from the provided player.

Parameters
player: Player?

The Player to control.

modifier: Modifier = Modifier

The Modifier to be applied to the button.

painter: @Composable ShuffleButtonState.() -> Painter = defaultShufflePainterIcon

The supplier for Painter used for the icon displayed on the button. This is a composable lambda with ShuffleButtonState as its receiver, allowing the icon to be updated based on the button's current state (e.g. ShuffleButtonState.shuffleOn).

contentDescription: @Composable ShuffleButtonState.() -> String = defaultShuffleContentDescription

The content description for accessibility purposes.

colors: IconButtonColors = IconButtonDefaults.iconButtonColors()

IconButtonColors that will be used to resolve the colors used for this icon button in different states. See IconButtonDefaults.iconButtonColors.

tint: Color = Color.Unspecified

Tint to be applied to painter. If Color.Unspecified is provided, then no tint is applied.

onClick: ShuffleButtonState.() -> Unit = ShuffleButtonState::onClick

The action to be performed when the button is clicked. This lambda has ShuffleButtonState as its receiver, providing access to the button's current state (e.g., ShuffleButtonState.isEnabled). The default behavior is to call ShuffleButtonState.onClick, which toggles the player's shuffle mode. Consumers can customize this behavior:

  • To add custom logic while still performing the default action, call this.onClick() within your lambda.

  • To completely override the default behavior, implement your custom logic without calling this.onClick(). Note that in this case, the button might still be enabled based on the player state, so ensure your custom logic handles cases where modifying the shuffle mode is not possible.