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 functions |
|
|---|---|
Unit |
@ComposableProvides a button for the primary action of a |
Unit |
@ComposableProvides a button for the optional secondary action of a |
Unit |
@ComposableProvides a button for the undo action of a |
Public functions
PrimaryActionButton
@Composable
fun PrimaryActionButton(
onClick: () -> Unit,
icon: @Composable () -> Unit,
text: @Composable () -> Unit,
modifier: Modifier = Modifier,
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified
): Unit
Provides a button for the primary action of a SwipeToReveal.
When first revealed the primary action displays an icon and then, if fully swiped, it additionally shows text. By default the button height is ButtonDefaults.Height - it is recommended to set the button height to SwipeToRevealDefaults.LargeActionButtonHeight for large content items like Cards, using Modifier.height.
| 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. |
text: @Composable () -> Unit |
Text composable to be displayed when the user fully swipes to execute the primary action. |
modifier: Modifier = Modifier |
|
containerColor: Color = Color.Unspecified |
Container color for this action. This can be |
contentColor: Color = Color.Unspecified |
Content color for this action. This can be |
SecondaryActionButton
@Composable
fun SecondaryActionButton(
onClick: () -> Unit,
icon: @Composable () -> Unit,
modifier: Modifier = Modifier,
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified
): Unit
Provides a button for the optional secondary action of a SwipeToReveal.
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. By default, the button height is ButtonDefaults.Height - it is recommended to set the button height to SwipeToRevealDefaults.LargeActionButtonHeight for large content items like Cards, using Modifier.height.
| 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. |
modifier: Modifier = Modifier |
|
containerColor: Color = Color.Unspecified |
Container color for this action.This can be |
contentColor: Color = Color.Unspecified |
Content color for this action. This can be |
UndoActionButton
@Composable
fun UndoActionButton(
onClick: () -> Unit,
text: @Composable () -> Unit,
modifier: Modifier = Modifier,
icon: (@Composable () -> Unit)? = null,
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified
): Unit
Provides a button for the undo action of a SwipeToReveal. When the user performs either the primary or secondary action, and the corresponding undo action is provided, the initial action will be hidden once SwipeToReveal has animated to the fully revealed state, and the undo action button will be displayed.
It is recommended to always use the default undo button height, ButtonDefaults.Height.
| 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. |
modifier: Modifier = Modifier |
|
icon: (@Composable () -> Unit)? = null |
Optional Icon composable to be displayed for this action. |
containerColor: Color = Color.Unspecified |
Container color for this action. This can be |
contentColor: Color = Color.Unspecified |
Content color for this action. This can be |