The class is used to create a scrim when a levitated pane is shown, to block the user interaction from the underlying layout. See AdaptStrategy.Levitate for more detailed info.

import androidx.compose.material3.Scaffold
import androidx.compose.material3.adaptive.layout.AdaptStrategy
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffold
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffoldDefaults
import androidx.compose.material3.adaptive.layout.Scrim
import androidx.compose.material3.adaptive.navigation.ThreePaneScaffoldNavigator
import androidx.compose.material3.adaptive.navigation.rememberListDetailPaneScaffoldNavigator
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment

val coroutineScope = rememberCoroutineScope()
var navigator: ThreePaneScaffoldNavigator<T>? = null
navigator =
    rememberListDetailPaneScaffoldNavigator<T>(
        adaptStrategies =
            ListDetailPaneScaffoldDefaults.adaptStrategies(
                extraPaneAdaptStrategy =
                    AdaptStrategy.Levitate(
                        strategy = AdaptStrategy.Levitate.Strategy.SinglePaneOnly,
                        alignment = Alignment.Center,
                        scrim =
                            Scrim(
                                onClick = {
                                    coroutineScope.launch { navigator?.navigateBack() }
                                }
                            )
                    )
            )
    )
return navigator

Summary

Public constructors

Scrim(color: Color, onClick: (() -> Unit)?)
Cmn

Public functions

open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
open String
Cmn

Public properties

Color

the color of scrim, by default if Color.Unspecified is provided, the pane scaffold implementation will use a translucent black color.

Cmn
(() -> Unit)?

the on-click listener of the scrim; usually used to dismiss the levitated pane; i.e. remove the pane from the top of the destination history.

Cmn

Public constructors

Scrim

Scrim(color: Color = Color.Unspecified, onClick: (() -> Unit)? = null)
Parameters
color: Color = Color.Unspecified

the color of scrim, by default if Color.Unspecified is provided, the pane scaffold implementation will use a translucent black color.

onClick: (() -> Unit)? = null

the on-click listener of the scrim; usually used to dismiss the levitated pane; i.e. remove the pane from the top of the destination history.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

color

val colorColor

the color of scrim, by default if Color.Unspecified is provided, the pane scaffold implementation will use a translucent black color.

onClick

val onClick: (() -> Unit)?

the on-click listener of the scrim; usually used to dismiss the levitated pane; i.e. remove the pane from the top of the destination history.