by @alexstyl
✉️ Leave your feedback

← Back to Wear Material

edgeSwipeToDismiss

Modifier
in
Wear Material
. Since 1.0.0

Overview

Examples

Community Notes

Limits swipe to dismiss to be active from the edge of the viewport only. Used when the center of the screen needs to be able to handle horizontal paging, such as 2-d scrolling a Map or swiping horizontally between pages. Swipe to the right is intercepted on the left part of the viewport with width specified by edgeWidth, with other touch events ignored - vertical scroll, click, long click, etc.

Currently Edge swipe, like swipe to dismiss, is only supported on the left part of the viewport regardless of layout direction as content is swiped away from left to right.

Requires that the element to which this modifier is applied exists within a SwipeToDismissBox which is using the same SwipeToDismissBoxState instance.

Example of a modifier usage with SwipeToDismiss

Overloads

edgeSwipeToDismiss

@Suppress("DEPRECATION")
@Deprecated(
    "SwipeToDismiss has been migrated to androidx.wear.compose.foundation. " +
        "Please import Modifier.edgeSwipeToDismiss from androidx.wear.compose.foundation instead.",
    replaceWith = ReplaceWith(
        "androidx.wear.compose.foundation.edgeSwipeToDismiss(",
        "swipeToDismissBoxState, edgeWidth)"
    )
)
public fun Modifier.edgeSwipeToDismiss(
    swipeToDismissBoxState: SwipeToDismissBoxState,
    edgeWidth: Dp = SwipeToDismissBoxDefaults.EdgeWidth
)

Parameters

NameDescription
swipeToDismissBoxStateA state of SwipeToDismissBox. Used to trigger swipe gestures on SwipeToDismissBox
edgeWidthA width of edge, where swipe should be recognise
Next ComponentAlert