I'm trying to embed a DatePicker into any composable without using a DatePickerDialog, but I don't know if there is any way to do this.
I've seen that the typical approach is using this dialog, where content is a DatePicker:
@ExperimentalMaterial3Api
@Composable
fun DatePickerDialog(
onDismissRequest: () -> Unit,
confirmButton: @Composable () -> Unit,
modifier: Modifier = Modifier,
dismissButton: @Composable (() -> Unit)? = null,
shape: Shape = DatePickerDefaults.shape,
tonalElevation: Dp = DatePickerDefaults.TonalElevation,
colors: DatePickerColors = DatePickerDefaults.colors(),
properties: DialogProperties = DialogProperties(usePlatformDefaultWidth = false),
content: @Composable ColumnScope.() -> Unit
)
But if I use directly a DatePicker without the dialog, I lose some important points:
- I haven't the backgrond surface of the dialog with M3 colors.
- I haven't the lambdas for confirm or cancel (I would like to hide the DatePicker when any action is done for example).
- Seems that the size of DatePicker should be adjusted and not fits well automatically as occurs with the DatePickerDialog
I've read in the M3 specificatios that there is a DockedDateDialog, but seems that is not ready yet: https://m3.material.io/components/date-pickers/overview
I haven't found any answer related to this question.
Thanks in advance