Skip to content

Instantly share code, notes, and snippets.

@tpoisson
tpoisson / DatePicker.kt
Last active April 11, 2024 09:05
DatePicker for Jetpack Compose and Material
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DatePickerWithDialog(
value: LocalDate?,
dateFormatter: (LocalDate) -> String,
enabled: Boolean = true,
placeholder: @Composable (() -> Unit)? = null,
dateValidator: (Long) -> Boolean = { true },
onChange: (LocalDate?) -> Unit
@tpoisson
tpoisson / Dropdown.kt
Last active April 1, 2023 10:36
Android Jetpack Compose Dropdown
/**
* Parameterized Dropdown for Jetpack Compose and Material3
* @param options list of options to display
* @param selectedValue the selected value for this field
* @param itemValue method called to determine the selected value matching options
* @param textValue the method called on object to display its label
* @param placeholder the placeholder displayed in the textfield
* @param enabled enable or disable the field
* @param onChange called when option is selected