SwipeToRevealDefaults
@ExperimentalWearMaterialApi
object SwipeToRevealDefaults
Defaults for Material SwipeToReveal.
Summary
Public functions |
|
|---|---|
SwipeToRevealActionColors |
@ComposableThe recommended colors used to display the contents of the primary, secondary and undo actions in |
Map<RevealValue, Float> |
createRevealAnchors(Creates the required anchors to which the top content can be swiped, to reveal the actions. |
Public properties |
|
|---|---|
RoundedCornerShape |
Recommended shape for |
ImageVector |
|
ImageVector |
|
(totalDistance: Float) -> Float |
Default position threshold that needs to be swiped in order to transition to the next state. |
Float |
Default ratio of the content displayed when in |
Public functions
actionColors
@Composable
fun actionColors(
primaryActionBackgroundColor: Color = MaterialTheme.colors.error,
primaryActionContentColor: Color = MaterialTheme.colors.onError,
secondaryActionBackgroundColor: Color = MaterialTheme.colors.surface,
secondaryActionContentColor: Color = MaterialTheme.colors.onSurface,
undoActionBackgroundColor: Color = MaterialTheme.colors.surface,
undoActionContentColor: Color = MaterialTheme.colors.onSurface
): SwipeToRevealActionColors
The recommended colors used to display the contents of the primary, secondary and undo actions in SwipeToReveal.
| Parameters | |
|---|---|
primaryActionBackgroundColor: Color = MaterialTheme.colors.error |
The background color (color of the shape) of the primary action |
primaryActionContentColor: Color = MaterialTheme.colors.onError |
The content color (text and icon) of the primary action |
secondaryActionBackgroundColor: Color = MaterialTheme.colors.surface |
The background color (color of the shape) of the secondary action |
secondaryActionContentColor: Color = MaterialTheme.colors.onSurface |
The content color (text and icon) of the secondary action |
undoActionBackgroundColor: Color = MaterialTheme.colors.surface |
The background color (color of the shape) of the undo action |
undoActionContentColor: Color = MaterialTheme.colors.onSurface |
The content color (text) of the undo action |
createRevealAnchors
fun createRevealAnchors(
coveredAnchor: Float = 0.0f,
revealingAnchor: Float = RevealingRatio,
revealedAnchor: Float = 1.0f,
revealDirection: RevealDirection = RevealDirection.RightToLeft
): Map<RevealValue, Float>
Creates the required anchors to which the top content can be swiped, to reveal the actions. Each value should be in the range 0..1, where 0 represents right most end and 1 represents the full width of the top content starting from right and ending on left.
| Parameters | |
|---|---|
coveredAnchor: Float = 0.0f |
Anchor for the |
revealingAnchor: Float = RevealingRatio |
Anchor for the |
revealedAnchor: Float = 1.0f |
Anchor for the |
revealDirection: RevealDirection = RevealDirection.RightToLeft |
The direction in which the content can be swiped. It's strongly advised to keep the default |
Public properties
CardActionShape
val CardActionShape: RoundedCornerShape
Recommended shape for SwipeToReveal actions when used with Card.
Delete
val Delete: ImageVector
ImageVector for delete icon, often used for the primary action.
MoreOptions
val MoreOptions: ImageVector
ImageVector for more options icon, often used for the secondary action.
PositionalThreshold
val PositionalThreshold: (totalDistance: Float) -> Float
Default position threshold that needs to be swiped in order to transition to the next state. Used in conjunction with RevealingRatio; for example, a threshold of 0.5 with a revealing ratio of 0.7 means that the user needs to swipe at least 35% (0.5 * 0.7) of the component width to go from RevealValue.Covered to RevealValue.RightRevealing and at least 85% (0.7 + 0.5 * (1 - 0.7)) of the component width to go from RevealValue.RightRevealing to RevealValue.RightRevealed.
RevealingRatio
val RevealingRatio: Float
Default ratio of the content displayed when in RevealValue.RightRevealing state, i.e. all the actions are revealed and the top content is not being swiped. For example, a value of 0.7 means that 70% of the width is used to place the actions.