Fixed
Status Update
Comments
jn...@google.com <jn...@google.com>
ap...@google.com <ap...@google.com> #2
I forgot to mention in the description that I'm using
Material version: androidx.compose.material3:material3:1.1.0-alpha08
IDE: Android Studio Electric Eel | 2022.1.1 Patch 2
Kotlin version : 1.8.10
Compose version : 1.3.3
this is the sample code.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DatePickSample(
colors: DatePickerColors = DatePickerDefaults.colors(
containerColor = Color.DarkGray,
titleContentColor = Color.White,
headlineContentColor = Color.White,
weekdayContentColor = Color.White,
subheadContentColor = Color.White,
currentYearContentColor = Color.White,
yearContentColor = Color.White,
selectedYearContainerColor = Color.DarkGray,
selectedYearContentColor = Color.White,
dayContentColor = Color.White,
selectedDayContainerColor = Color.Black,
selectedDayContentColor = Color.White,
disabledDayContentColor = Color.LightGray,
todayContentColor = Color.White,
todayDateBorderColor = Color.White,
disabledSelectedDayContainerColor = Color.DarkGray,
disabledSelectedDayContentColor = Color.White,
dayInSelectionRangeContentColor = Color.White,
dayInSelectionRangeContainerColor = Color.White,
),
) {
val openDialog = remember { mutableStateOf(false) }
if (openDialog.value) {
val datePickerState = rememberDatePickerState(initialSelectedDateMillis = Date().time)
val confirmEnabled = remember {
derivedStateOf { datePickerState.selectedDateMillis != null }
}
DatePickerDialog(
onDismissRequest = {
openDialog.value = false
},
confirmButton = {
Button( onClick = {
openDialog.value = false
println("date selected: ${datePickerState.selectedDateMillis}")
},
colors = ButtonDefaults.buttonColors(
containerColor = Color.LightGray,
contentColor = Color.Black
)
) {
Text(text = "ok")
}
},
dismissButton = {
Button( onClick = {
openDialog.value = false
},
colors = ButtonDefaults.buttonColors(
containerColor = Color.LightGray,
contentColor = Color.Black
)
) {
Text(text = "cancel")
}
},
colors = colors,
) {
DatePicker(
state = datePickerState,
colors = colors,
showModeToggle = false
)
}
}
Button( onClick = {
openDialog.value = !openDialog.value
}) {
Text(text = "toggle date picker", color = Color.White)
}
}
Colors also not set when you set showModeToggle to true and click on InputMode
PS: It should be possible to customize the colors of the all datepicker's UI elements based on the app's own color scheme, in addition to the predefined color schemes provided by MaterialTheme
Description
Component used: ToggleChip Version used: 1.0.0
There is a bug in the layout of ToggleChip - the toggle control is supposed to be 24x24,dp with a 4.dp spacer between the toggle control and the text - but currently the toggle control box is 36.dp wide with no spacer.
As a result the size of the space left for the label is 8.dp narrower than it is designed to be