Package com.vanpra.composematerialdialogs

Types

MaterialDialogButtons
Link copied to clipboard
class MaterialDialogButtons(scope: MaterialDialogScope)

A class used to build a buttons layout for a MaterialDialog. This should be used in conjunction with the com.vanpra.composematerialdialogs.MaterialDialog.dialogButtons function

MaterialDialogScope
Link copied to clipboard
interface MaterialDialogScope

Interface defining values and functions which are available to any code within a MaterialDialog's content parameter

MaterialDialogState
Link copied to clipboard
class MaterialDialogState(initialValue: Boolean)

The MaterialDialogState class is used to store the state for a MaterialDialog

Functions

customView
Link copied to clipboard
@Composable
fun MaterialDialogScope.customView(content: @Composable () -> Unit)

Create an view in the dialog with the given content and appropriate padding

iconTitle
Link copied to clipboard
@Composable
fun MaterialDialogScope.iconTitle(text: String? = null, @StringRes textRes: Int? = null, icon: @Composable () -> Unit = {})

Adds a title with the given text and icon to the dialog

input
Link copied to clipboard
@Composable
fun MaterialDialogScope.input(label: String, hint: String = "", prefill: String = "", waitForPositiveButton: Boolean = true, visualTransformation: VisualTransformation = VisualTransformation.None, keyboardOptions: KeyboardOptions = KeyboardOptions(), keyboardActions: KeyboardActions = KeyboardActions(), errorMessage: String = "", focusRequester: FocusRequester = FocusRequester.Default, focusOnShow: Boolean = false, isTextValid: (String) -> Boolean = { true }, onInput: (String) -> Unit = {})

Adds an input field with the given parameters to the dialog

listItems
Link copied to clipboard
@Composable
fun MaterialDialogScope.listItems(list: List<String>, closeOnClick: Boolean = true, onClick: (index: Int, item: String) -> Unit = { _, _ -> })

Adds a selectable plain text list to the dialog

@Composable
fun <T> MaterialDialogScope.listItems(modifier: Modifier = Modifier, list: List<T>, closeOnClick: Boolean = true, onClick: (index: Int, T) -> Unit = { _, _ -> }, isEnabled: (index: Int) -> Boolean = { _ -> true }, item: @Composable (index: Int, T) -> Unit)

Adds a selectable list with custom items to the dialog

listItemsMultiChoice
Link copied to clipboard
@Composable
fun MaterialDialogScope.listItemsMultiChoice(list: List<String>, disabledIndices: Set<Int> = setOf(), initialSelection: Set<Int> = setOf(), waitForPositiveButton: Boolean = true, onCheckedChange: (indices: Set<Int>) -> Unit = {})

Adds a multi-choice list view to the dialog

listItemsSingleChoice
Link copied to clipboard
@Composable
fun MaterialDialogScope.listItemsSingleChoice(list: List<String>, disabledIndices: Set<Int> = setOf(), initialSelection: Int? = null, waitForPositiveButton: Boolean = true, onChoiceChange: (selected: Int) -> Unit = {})

Adds a single-choice list view to the dialog

MaterialDialog
Link copied to clipboard
@Composable
fun MaterialDialog(dialogState: MaterialDialogState = rememberMaterialDialogState(), properties: DialogProperties = DialogProperties(), backgroundColor: Color = MaterialTheme.colors.surface, shape: Shape = MaterialTheme.shapes.medium, border: BorderStroke? = null, elevation: Dp = 24.dp, autoDismiss: Boolean = true, onCloseRequest: (MaterialDialogState) -> Unit = { it.hide() }, buttons: @Composable MaterialDialogButtons.() -> Unit = {}, content: @Composable MaterialDialogScope.() -> Unit)

Builds a dialog with the given content

message
Link copied to clipboard
@Composable
fun MaterialDialogScope.message(text: String? = null, @StringRes res: Int? = null)

Adds paragraph of text to the dialog

rememberMaterialDialogState
Link copied to clipboard
@Composable
fun rememberMaterialDialogState(initialValue: Boolean = false): MaterialDialogState

Create and remember a MaterialDialogState.

title
Link copied to clipboard
@Composable
fun MaterialDialogScope.title(text: String? = null, @StringRes res: Int? = null, center: Boolean = false)

Adds a title with the given text to the dialog