SwipeToRevealScope

class SwipeToRevealScope


Scope for the actions of a SwipeToReveal composable. Used to define the primary, secondary, undo primary and undo secondary actions.

Summary

Public constructors

Public functions

Unit
primaryAction(
    onClick: () -> Unit,
    icon: @Composable () -> Unit,
    text: @Composable () -> Unit,
    label: String,
    containerColor: Color,
    contentColor: Color
)

Adds the primary action to a SwipeToReveal.

Unit
secondaryAction(
    onClick: () -> Unit,
    icon: @Composable () -> Unit,
    label: String,
    containerColor: Color,
    contentColor: Color
)

Adds the secondary action to a SwipeToReveal.

Unit
undoPrimaryAction(
    onClick: () -> Unit,
    text: @Composable () -> Unit,
    icon: (@Composable () -> Unit)?,
    containerColor: Color,
    contentColor: Color
)

Adds the undo action for the primary action to a SwipeToReveal.

Unit
undoSecondaryAction(
    onClick: () -> Unit,
    text: @Composable () -> Unit,
    icon: (@Composable () -> Unit)?,
    containerColor: Color,
    contentColor: Color
)

Adds the undo action for the secondary action to a SwipeToReveal.

Public constructors

SwipeToRevealScope

Added in 1.0.0-alpha31
SwipeToRevealScope()

Public functions

primaryAction

fun primaryAction(
    onClick: () -> Unit,
    icon: @Composable () -> Unit,
    text: @Composable () -> Unit,
    label: String,
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified
): Unit

Adds the primary action to a SwipeToReveal. This is required and exactly one primary action should be specified. In case there are multiple, only the latest one will be displayed.

When first revealed the primary action displays an icon and then, if fully swiped, it additionally shows text.

Parameters
onClick: () -> Unit

Callback to be executed when the action is performed via a full swipe, or a button click.

icon: @Composable () -> Unit

Icon composable to be displayed for this action.

text: @Composable () -> Unit

Text composable to be displayed when the user fully swipes to execute the primary action.

label: String

Label for this action. Used to create a CustomAccessibilityAction for the SwipeToReveal component.

containerColor: Color = Color.Unspecified

Container color for this action.

contentColor: Color = Color.Unspecified

Content color for this action.

secondaryAction

fun secondaryAction(
    onClick: () -> Unit,
    icon: @Composable () -> Unit,
    label: String,
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified
): Unit

Adds the secondary action to a SwipeToReveal. This is optional and at most one secondary action should be specified. In case there are multiple, only the latest one will be displayed.

Secondary action only displays an icon, because, unlike the primary action, it is never extended to full width so does not have room to display text.

Parameters
onClick: () -> Unit

Callback to be executed when the action is performed via a button click.

icon: @Composable () -> Unit

Icon composable to be displayed for this action.

label: String

Label for this action. Used to create a CustomAccessibilityAction for the SwipeToReveal component.

containerColor: Color = Color.Unspecified

Container color for this action.

contentColor: Color = Color.Unspecified

Content color for this action.

undoPrimaryAction

fun undoPrimaryAction(
    onClick: () -> Unit,
    text: @Composable () -> Unit,
    icon: (@Composable () -> Unit)? = null,
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified
): Unit

Adds the undo action for the primary action to a SwipeToReveal. Displayed after the user performs the primary action. This is optional and at most one undo primary action should be specified. In case there are multiple, only the latest one will be displayed.

Parameters
onClick: () -> Unit

Callback to be executed when the action is performed via a button click.

text: @Composable () -> Unit

Text composable to indicate what the undo action is, to be displayed when the user executes the primary action. This should include appropriated semantics for accessibility.

icon: (@Composable () -> Unit)? = null

Optional Icon composable to be displayed for this action.

containerColor: Color = Color.Unspecified

Container color for this action.

contentColor: Color = Color.Unspecified

Content color for this action.

undoSecondaryAction

fun undoSecondaryAction(
    onClick: () -> Unit,
    text: @Composable () -> Unit,
    icon: (@Composable () -> Unit)? = null,
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified
): Unit

Adds the undo action for the secondary action to a SwipeToReveal. Displayed after the user performs the secondary action.This is optional and at most one undo secondary action should be specified. In case there are multiple, only the latest one will be displayed.

Parameters
onClick: () -> Unit

Callback to be executed when the action is performed via a button click.

text: @Composable () -> Unit

Text composable to indicate what the undo action is, to be displayed when the user executes the primary action. This should include appropriated semantics for accessibility.

icon: (@Composable () -> Unit)? = null

Optional Icon composable to be displayed for this action.

containerColor: Color = Color.Unspecified

Container color for this action.

contentColor: Color = Color.Unspecified

Content color for this action.