ModalScaffold

fun ModalScaffold(onClose: () -> Unit, modifier: Modifier = Modifier, contentPadding: PaddingValues = DialogPadding, snackbarHost: @Composable () -> Unit = {}, mainButton: @Composable (Modifier) -> Unit? = {}, supportButton: @Composable (Modifier) -> Unit? = {}, title: @Composable () -> Unit = {}, actions: @Composable RowScope.() -> Unit = {}, content: @Composable (PaddingValues) -> Unit)

A composable function that creates a full-screen modal scaffold, adapting its layout based on the device's screen size and orientation.

The scaffold provides different layouts for phone portrait, phone landscape, and other devices (e.g., tablets or foldables) where it'll show a modal instead.

IF you don't want the Bottom App Bar to appear then provide null to both mainButton&supportButton

Parameters

onClose

callback that will be invoked when the modal is dismissed

snackbarHost

Component to host Snackbars that are pushed to be shown

modifier

applied to the root Scaffold

mainButton

the main actions for this modal (should be a ButtonFilled most of the time)

supportButton

the support or alternative actions for this modal (should any other button than ButtonFilled) portrait mode

title

the title of the modal

actions

the actions displayed at the end of the top app bar. This should typically be

  • IconButtons. The default layout here is a Row, so icons inside will be placed horizontally.

content

the center custom Composable for modal content