Package com.vanpra.composematerialdialogs

Types

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

Link copied to clipboard
interface MaterialDialogScope

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

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

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

Link copied to clipboard
enum TextFieldStyle : Enum<TextFieldStyle>

Functions

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

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

Link copied to clipboard
fun MaterialDialogScope.iconTitle(    text: String? = null,     @StringRes textRes: Int? = null,     color: Color = MaterialTheme.colors.onSurface,     style: TextStyle = MaterialTheme.typography.h6,     icon: @Composable () -> Unit = {})

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

Link copied to clipboard
fun MaterialDialogScope.input(    modifier: Modifier = Modifier,     label: String,     placeholder: String = "",     prefill: String = "",     enabled: Boolean = true,     readOnly: Boolean = false,     textStyle: TextStyle = LocalTextStyle.current,     leadingIcon: @Composable () -> Unit? = null,     trailingIcon: @Composable () -> Unit? = null,     visualTransformation: VisualTransformation = VisualTransformation.None,     keyboardOptions: KeyboardOptions = KeyboardOptions.Default,     keyboardActions: KeyboardActions = KeyboardActions(),     singleLine: Boolean = false,     maxLines: Int = Int.MAX_VALUE,     interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },     colors: TextFieldColors = TextFieldDefaults.textFieldColors(),     textFieldStyle: TextFieldStyle = TextFieldStyle.Filled,     waitForPositiveButton: Boolean = true,     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

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

Adds a selectable plain text list to the dialog

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

Adds a selectable list with custom items to the dialog

Link copied to clipboard
fun MaterialDialogScope.listItemsMultiChoice(    list: List<String>,     state: LazyListState = rememberLazyListState(),     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

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

Adds a single-choice list view to the dialog

Link copied to clipboard
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

Link copied to clipboard
fun MaterialDialogScope.message(    text: String? = null,     color: Color = MaterialTheme.colors.onSurface,     style: TextStyle = MaterialTheme.typography.body1,     @StringRes res: Int? = null)

Adds paragraph of text to the dialog

Link copied to clipboard
fun rememberMaterialDialogState(initialValue: Boolean = false): MaterialDialogState
Link copied to clipboard
fun MaterialDialogScope.title(    text: String? = null,     @StringRes res: Int? = null,     color: Color = MaterialTheme.colors.onSurface,     style: TextStyle = MaterialTheme.typography.h6,     center: Boolean = false)

Adds a title with the given text to the dialog