| <html devsite="true"> |
| <head> |
| <title>DismissState</title> |
| {% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} |
| {% include "_shared/_reference-head-tags.html" %} |
| </head> |
| <body> |
| <div id="metadata-info-block"></div> |
| <h1>DismissState</h1> |
| <p> |
| <pre>@<a href="/reference/androidx/compose/material/ExperimentalMaterialApi.html">ExperimentalMaterialApi</a><br>public final class <a href="/reference/androidx/compose/material/DismissState.html">DismissState</a> extends <a href="/reference/androidx/compose/material/SwipeableState.html">SwipeableState</a></pre> |
| </p> |
| <div class="devsite-table-wrapper"> |
| <table class="jd-inheritance-table"> |
| <tbody> |
| <tr> |
| <td colspan="3"><a href="https://developer.android.com/reference/java/lang/Object.html">java.lang.Object</a></td> |
| </tr> |
| <tr> |
| <td class="jd-inheritance-space"> ↳</td> |
| <td colspan="2"><a href="/reference/androidx/compose/material/SwipeableState.html">androidx.compose.material.SwipeableState</a></td> |
| </tr> |
| <tr> |
| <td> </td> |
| <td class="jd-inheritance-space"> ↳</td> |
| <td colspan="1"><a href="/reference/androidx/compose/material/DismissState.html">androidx.compose.material.DismissState</a></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <hr> |
| <p>State of the <code><a href="/reference/androidx/compose/material/package-summary.html#SwipeToDismiss(androidx.compose.material.DismissState,androidx.compose.ui.Modifier,kotlin.collections.Set,kotlin.Function1,kotlin.Function1,kotlin.Function1)">SwipeToDismiss</a></code> composable.</p> |
| <h2>Summary</h2> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Nested types</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td width="40%"><code>public static class <a href="/reference/androidx/compose/material/DismissState.Companion.html">DismissState.Companion</a></code></td> |
| <td></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Public fields</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td width="40%"><code>final <a href="/reference/androidx/compose/material/DismissDirection.html">DismissDirection</a></code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/DismissState.html#dismissDirection()">dismissDirection</a></code></div> |
| <p>The direction (if any) in which the composable has been or is being dismissed.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Public constructors</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/DismissState.html#DismissState(androidx.compose.material.DismissValue,kotlin.Function1)">DismissState</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a> initialValue,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>> confirmStateChange<br>)</code></div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Public methods</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td width="40%"><code>final void</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/DismissState.html#dismiss(androidx.compose.material.DismissDirection)">dismiss</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissDirection.html">DismissDirection</a> direction)</code></div> |
| <p>Dismiss the component in the given <code><a href="/reference/androidx/compose/material/DismissState.html#dismiss(androidx.compose.material.DismissDirection)">direction</a></code>, with an animation and suspend.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final boolean</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/DismissState.html#isDismissed(androidx.compose.material.DismissDirection)">isDismissed</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissDirection.html">DismissDirection</a> direction)</code></div> |
| <p>Whether the component has been dismissed in the given <code><a href="/reference/androidx/compose/material/DismissState.html#isDismissed(androidx.compose.material.DismissDirection)">direction</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final void</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/DismissState.html#reset()">reset</a>()</code></div> |
| <p>Reset the component to the default position with animation and suspend until it if fully reset or animation has been cancelled.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive" id="inhmethods"> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Inherited fields</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><devsite-expandable><span class="expand-control">From <a href="/reference/androidx/compose/material/SwipeableState.html">androidx.compose.material.SwipeableState</a></span> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <tbody class="list"> |
| <tr> |
| <td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a></code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/SwipeableState.html#currentValue()">currentValue</a></code></div> |
| <p>The current value of the state.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final float</code></td> |
| <td> |
| <div><code>@<a href="/reference/androidx/compose/material/ExperimentalMaterialApi.html">ExperimentalMaterialApi</a><br><a href="/reference/androidx/compose/material/SwipeableState.html#direction()">direction</a></code></div> |
| <p>The direction in which the <code><a href="/reference/androidx/compose/material/package-summary.html#(androidx.compose.ui.Modifier).swipeable(androidx.compose.material.SwipeableState,kotlin.collections.Map,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function2,androidx.compose.material.ResistanceConfig,androidx.compose.ui.unit.Dp)">swipeable</a></code> is moving, relative to the current <code><a href="/reference/androidx/compose/material/SwipeableState.html#currentValue()">currentValue</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final boolean</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/SwipeableState.html#isAnimationRunning()">isAnimationRunning</a></code></div> |
| <p>Whether the state is currently animating.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/State.html">State</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Float.html">Float</a>></code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/SwipeableState.html#offset()">offset</a></code></div> |
| <p>The current position (in pixels) of the <code><a href="/reference/androidx/compose/material/package-summary.html#(androidx.compose.ui.Modifier).swipeable(androidx.compose.material.SwipeableState,kotlin.collections.Map,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function2,androidx.compose.material.ResistanceConfig,androidx.compose.ui.unit.Dp)">swipeable</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/State.html">State</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Float.html">Float</a>></code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/SwipeableState.html#overflow()">overflow</a></code></div> |
| <p>The amount by which the <code><a href="/reference/androidx/compose/material/package-summary.html#(androidx.compose.ui.Modifier).swipeable(androidx.compose.material.SwipeableState,kotlin.collections.Map,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function2,androidx.compose.material.ResistanceConfig,androidx.compose.ui.unit.Dp)">swipeable</a></code> has been swiped past its bounds.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/SwipeProgress.html">SwipeProgress</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a>></code></td> |
| <td> |
| <div><code>@<a href="/reference/androidx/compose/material/ExperimentalMaterialApi.html">ExperimentalMaterialApi</a><br><a href="/reference/androidx/compose/material/SwipeableState.html#progress()">progress</a></code></div> |
| <p>Information about the ongoing swipe or animation, if any.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a></code></td> |
| <td> |
| <div><code>@<a href="/reference/androidx/compose/material/ExperimentalMaterialApi.html">ExperimentalMaterialApi</a><br><a href="/reference/androidx/compose/material/SwipeableState.html#targetValue()">targetValue</a></code></div> |
| <p>The target value of the state.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </devsite-expandable> </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive" id="inhmethods"> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Inherited methods</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><devsite-expandable><span class="expand-control">From <a href="/reference/androidx/compose/material/SwipeableState.html">androidx.compose.material.SwipeableState</a></span> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <tbody class="list"> |
| <tr> |
| <td width="40%"><code>final void</code></td> |
| <td> |
| <div><code>@<a href="/reference/androidx/compose/material/ExperimentalMaterialApi.html">ExperimentalMaterialApi</a><br><a href="/reference/androidx/compose/material/SwipeableState.html#animateTo(androidx.compose.material.DismissValue,androidx.compose.animation.core.AnimationSpec)">animateTo</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a> targetValue,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/animation/core/AnimationSpec.html">AnimationSpec</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Float.html">Float</a>> anim<br>)</code></div> |
| <p>Set the state to the target value by starting an animation.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final float</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/SwipeableState.html#performDrag(kotlin.Float)">performDrag</a>(float delta)</code></div> |
| <p>Force <code><a href="/reference/androidx/compose/material/package-summary.html#(androidx.compose.ui.Modifier).swipeable(androidx.compose.material.SwipeableState,kotlin.collections.Map,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function2,androidx.compose.material.ResistanceConfig,androidx.compose.ui.unit.Dp)">swipeable</a></code> to consume drag delta provided from outside of the regular <code><a href="/reference/androidx/compose/material/package-summary.html#(androidx.compose.ui.Modifier).swipeable(androidx.compose.material.SwipeableState,kotlin.collections.Map,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function2,androidx.compose.material.ResistanceConfig,androidx.compose.ui.unit.Dp)">swipeable</a></code> gesture flow.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final void</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/material/SwipeableState.html#performFling(kotlin.Float)">performFling</a>(float velocity)</code></div> |
| <p>Perform fling with settling to one of the anchors which is determined by the given <code><a href="/reference/androidx/compose/material/SwipeableState.html#performFling(kotlin.Float)">velocity</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final void</code></td> |
| <td> |
| <div><code>@<a href="/reference/androidx/compose/material/ExperimentalMaterialApi.html">ExperimentalMaterialApi</a><br><a href="/reference/androidx/compose/material/SwipeableState.html#snapTo(androidx.compose.material.DismissValue)">snapTo</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a> targetValue)</code></div> |
| <p>Set the state without any animation and suspend until it's set</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </devsite-expandable> </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <h2>Public fields</h2> |
| <div><a name="getDismissDirection()"></a><a name="setDismissDirection()"></a><a name="getDismissDirection--"></a><a name="setDismissDirection--"></a> |
| <h3 class="api-name" id="dismissDirection()">dismissDirection</h3> |
| <pre class="api-signature no-pretty-print">public final <a href="/reference/androidx/compose/material/DismissDirection.html">DismissDirection</a> <a href="/reference/androidx/compose/material/DismissState.html#dismissDirection()">dismissDirection</a></pre> |
| <p>The direction (if any) in which the composable has been or is being dismissed.</p> |
| <p>If the composable is settled at the default state, then this will be null. Use this to change the background of the <code><a href="/reference/androidx/compose/material/package-summary.html#SwipeToDismiss(androidx.compose.material.DismissState,androidx.compose.ui.Modifier,kotlin.collections.Set,kotlin.Function1,kotlin.Function1,kotlin.Function1)">SwipeToDismiss</a></code> if you want different actions on each side.</p> |
| </div> |
| <h2>Public constructors</h2> |
| <div><a name="DismissState(androidx.compose.material.DismissValue, kotlin.Function1)"></a><a name="DismissState-androidx.compose.material.DismissValue-kotlin.Function1-"></a><a name="dismissstate"></a> |
| <h3 class="api-name" id="DismissState(androidx.compose.material.DismissValue,kotlin.Function1)">DismissState</h3> |
| <pre class="api-signature no-pretty-print">public <a href="/reference/androidx/compose/material/DismissState.html#DismissState(androidx.compose.material.DismissValue,kotlin.Function1)">DismissState</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a> initialValue,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>> confirmStateChange<br>)</pre> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a> initialValue</code></td> |
| <td> |
| <p>The initial value of the state.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissValue.html">DismissValue</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>> confirmStateChange</code></td> |
| <td> |
| <p>Optional callback invoked to confirm or veto a pending state change.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <h2>Public methods</h2> |
| <div><a name="dismiss-androidx.compose.material.DismissDirection-"></a><a name="dismiss"></a> |
| <h3 class="api-name" id="dismiss(androidx.compose.material.DismissDirection)">dismiss</h3> |
| <pre class="api-signature no-pretty-print">public final void <a href="/reference/androidx/compose/material/DismissState.html#dismiss(androidx.compose.material.DismissDirection)">dismiss</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissDirection.html">DismissDirection</a> direction)</pre> |
| <p>Dismiss the component in the given <code><a href="/reference/androidx/compose/material/DismissState.html#dismiss(androidx.compose.material.DismissDirection)">direction</a></code>, with an animation and suspend. This method will throw <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-cancellation-exception/index.html">CancellationException</a></code> if the animation is interrupted</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissDirection.html">DismissDirection</a> direction</code></td> |
| <td> |
| <p>The dismiss direction.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="isDismissed-androidx.compose.material.DismissDirection-"></a><a name="isdismissed"></a> |
| <h3 class="api-name" id="isDismissed(androidx.compose.material.DismissDirection)">isDismissed</h3> |
| <pre class="api-signature no-pretty-print">public final boolean <a href="/reference/androidx/compose/material/DismissState.html#isDismissed(androidx.compose.material.DismissDirection)">isDismissed</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissDirection.html">DismissDirection</a> direction)</pre> |
| <p>Whether the component has been dismissed in the given <code><a href="/reference/androidx/compose/material/DismissState.html#isDismissed(androidx.compose.material.DismissDirection)">direction</a></code>.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/DismissDirection.html">DismissDirection</a> direction</code></td> |
| <td> |
| <p>The dismiss direction.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="reset--"></a><a name="reset"></a> |
| <h3 class="api-name" id="reset()">reset</h3> |
| <pre class="api-signature no-pretty-print">public final void <a href="/reference/androidx/compose/material/DismissState.html#reset()">reset</a>()</pre> |
| <p>Reset the component to the default position with animation and suspend until it if fully reset or animation has been cancelled. This method will throw <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-cancellation-exception/index.html">CancellationException</a></code> if the animation is interrupted</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td width="40%"><code>void</code></td> |
| <td> |
| <p>the reason the reset animation ended</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| </body> |
| </html> |