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,
    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,
    label: String,
    icon: (@Composable () -> Unit)?,
    containerColor: Color,
    contentColor: Color
)

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

Unit
undoSecondaryAction(
    onClick: () -> Unit,
    label: String,
    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-alpha30
SwipeToRevealScope()

Public functions

primaryAction

fun primaryAction(
    onClick: () -> Unit,
    icon: @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.

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.

label: String

Label for this action. Used to create a CustomAccessibilityAction for the SwipeToReveal component, and to display what the action is when the user fully swipes to execute the primary action.

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.

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,
    label: String,
    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.

label: String

Label for this action. Used to display what the undo action is after the user executes the primary action.

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,
    label: String,
    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.

label: String

Label for this action. Used to display what the undo action is after the user executes the secondary action.

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.