blob: 1d8c6c0101b9da68842c3d6c5711de405b3af9b3 [file] [log] [blame]
<html devsite="true">
<head>
<title>BottomSheetState</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div id="metadata-info-block"></div>
<h1>BottomSheetState</h1>
<p>
<pre>@<a href="/reference/androidx/compose/material/ExperimentalMaterialApi.html">ExperimentalMaterialApi</a><br>public final class <a href="/reference/androidx/compose/material/BottomSheetState.html">BottomSheetState</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">&nbsp;&nbsp;&nbsp;↳</td>
<td colspan="2"><a href="/reference/androidx/compose/material/SwipeableState.html">androidx.compose.material.SwipeableState</a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;↳</td>
<td colspan="1"><a href="/reference/androidx/compose/material/BottomSheetState.html">androidx.compose.material.BottomSheetState</a></td>
</tr>
</tbody>
</table>
</div>
<hr>
<p>State of the persistent bottom sheet in <code><a href="/reference/androidx/compose/material/package-summary.html#BottomSheetScaffold(kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.material.BottomSheetScaffoldState,kotlin.Function0,kotlin.Function1,kotlin.Function0,androidx.compose.material.FabPosition,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,kotlin.Function1,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,kotlin.Function1)">BottomSheetScaffold</a></code>.</p>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Nested types</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code>public static class <a href="/reference/androidx/compose/material/BottomSheetState.Companion.html">BottomSheetState.Companion</a></code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public fields</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>final boolean</code></td>
<td>
<div><code><a href="/reference/androidx/compose/material/BottomSheetState.html#isCollapsed()">isCollapsed</a></code></div>
<p>Whether the bottom sheet is collapsed.</p>
</td>
</tr>
<tr>
<td width="40%"><code>final boolean</code></td>
<td>
<div><code><a href="/reference/androidx/compose/material/BottomSheetState.html#isExpanded()">isExpanded</a></code></div>
<p>Whether the bottom sheet is expanded.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<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/BottomSheetState.html#BottomSheetState(androidx.compose.material.BottomSheetValue,androidx.compose.animation.core.AnimationSpec,kotlin.Function1)">BottomSheetState</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/BottomSheetValue.html">BottomSheetValue</a>&nbsp;initialValue,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/animation/core/AnimationSpec.html">AnimationSpec</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Float.html">Float</a>&gt;&nbsp;animationSpec,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/BottomSheetValue.html">BottomSheetValue</a>,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>&gt;&nbsp;confirmStateChange<br>)</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<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/BottomSheetState.html#collapse()">collapse</a>()</code></div>
<p>Collapse the bottom sheet with animation and suspend until it if fully collapsed or animation has been cancelled.</p>
</td>
</tr>
<tr>
<td width="40%"><code>final void</code></td>
<td>
<div><code><a href="/reference/androidx/compose/material/BottomSheetState.html#expand()">expand</a>()</code></div>
<p>Expand the bottom sheet with animation and suspend until it if fully expanded 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">
<colgroup>
<col width="40%">
<col>
</colgroup>
<tbody class="list">
<tr>
<td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/BottomSheetValue.html">BottomSheetValue</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>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Float.html">Float</a>&gt;</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>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Float.html">Float</a>&gt;</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>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/BottomSheetValue.html">BottomSheetValue</a>&gt;</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/BottomSheetValue.html">BottomSheetValue</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">
<colgroup>
<col width="40%">
<col>
</colgroup>
<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.BottomSheetValue,androidx.compose.animation.core.AnimationSpec)">animateTo</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/BottomSheetValue.html">BottomSheetValue</a>&nbsp;targetValue,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/animation/core/AnimationSpec.html">AnimationSpec</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Float.html">Float</a>&gt;&nbsp;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&nbsp;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&nbsp;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.BottomSheetValue)">snapTo</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/BottomSheetValue.html">BottomSheetValue</a>&nbsp;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>
<div class="list">
<h2>Public fields</h2>
<div class="api-item"><a name="getIsCollapsed()"></a><a name="setIsCollapsed()"></a><a name="getIsCollapsed--"></a><a name="setIsCollapsed--"></a>
<h3 class="api-name" id="isCollapsed()">isCollapsed</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/compose/material/BottomSheetState.html#isCollapsed()">isCollapsed</a></pre>
<p>Whether the bottom sheet is collapsed.</p>
</div>
<div class="api-item"><a name="getIsExpanded()"></a><a name="setIsExpanded()"></a><a name="getIsExpanded--"></a><a name="setIsExpanded--"></a>
<h3 class="api-name" id="isExpanded()">isExpanded</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/compose/material/BottomSheetState.html#isExpanded()">isExpanded</a></pre>
<p>Whether the bottom sheet is expanded.</p>
</div>
</div>
<div class="list">
<h2>Public constructors</h2>
<div class="api-item"><a name="BottomSheetState(androidx.compose.material.BottomSheetValue, androidx.compose.animation.core.AnimationSpec, kotlin.Function1)"></a><a name="BottomSheetState-androidx.compose.material.BottomSheetValue-androidx.compose.animation.core.AnimationSpec-kotlin.Function1-"></a><a name="bottomsheetstate"></a>
<h3 class="api-name" id="BottomSheetState(androidx.compose.material.BottomSheetValue,androidx.compose.animation.core.AnimationSpec,kotlin.Function1)">BottomSheetState</h3>
<pre class="api-signature no-pretty-print">public&nbsp;<a href="/reference/androidx/compose/material/BottomSheetState.html#BottomSheetState(androidx.compose.material.BottomSheetValue,androidx.compose.animation.core.AnimationSpec,kotlin.Function1)">BottomSheetState</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/BottomSheetValue.html">BottomSheetValue</a>&nbsp;initialValue,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/animation/core/AnimationSpec.html">AnimationSpec</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Float.html">Float</a>&gt;&nbsp;animationSpec,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/BottomSheetValue.html">BottomSheetValue</a>,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>&gt;&nbsp;confirmStateChange<br>)</pre>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<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/BottomSheetValue.html">BottomSheetValue</a>&nbsp;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> <a href="/reference/androidx/compose/animation/core/AnimationSpec.html">AnimationSpec</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Float.html">Float</a>&gt;&nbsp;animationSpec</code></td>
<td>
<p>The default animation that will be used to animate to a new state.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/material/BottomSheetValue.html">BottomSheetValue</a>,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>&gt;&nbsp;confirmStateChange</code></td>
<td>
<p>Optional callback invoked to confirm or veto a pending state change.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="list">
<h2>Public methods</h2>
<div class="api-item"><a name="collapse--"></a><a name="collapse"></a>
<h3 class="api-name" id="collapse()">collapse</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/compose/material/BottomSheetState.html#collapse()">collapse</a>()</pre>
<p>Collapse the bottom sheet with animation and suspend until it if fully collapsed 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">
<colgroup>
<col width="40%">
<col>
</colgroup>
<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 collapse animation ended</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="expand--"></a><a name="expand"></a>
<h3 class="api-name" id="expand()">expand</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/compose/material/BottomSheetState.html#expand()">expand</a>()</pre>
<p>Expand the bottom sheet with animation and suspend until it if fully expanded 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">
<colgroup>
<col width="40%">
<col>
</colgroup>
<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 expand animation ended</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>