Fixed
Status Update
Comments
sa...@gmail.com <sa...@gmail.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
co...@google.com <co...@google.com>
sg...@google.com <sg...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 8b3441338fc74687fed347fe85fe8ed9dc6b9844
Author: Shalom Gibly <sgibly@google.com>
Date: Thu Mar 30 05:34:49 2023
Additional color customizations for date pickers
Updates to the DatePickerColors to include additional color params for
the date picker dividers and navigation components, as well as a
TextFieldColors parameter for customizing the text fields when in a date
input mode.
Bug: 274626815
Test: Manual & verified that the screenshot tests are passing
RelNote: "Updated the DatePickerColors to include additional
customization options for the date picker divider, navigation, and text
input fields colors."
Change-Id: I1a6856afd9a84e2aec18ece4ed6646b7f4ff4079
M compose/material3/material3/api/public_plus_experimental_current.txt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateInput.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DatePicker.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateRangeInput.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateRangePicker.kt
https://android-review.googlesource.com/2514032
Branch: androidx-main
commit 8b3441338fc74687fed347fe85fe8ed9dc6b9844
Author: Shalom Gibly <sgibly@google.com>
Date: Thu Mar 30 05:34:49 2023
Additional color customizations for date pickers
Updates to the DatePickerColors to include additional color params for
the date picker dividers and navigation components, as well as a
TextFieldColors parameter for customizing the text fields when in a date
input mode.
Bug: 274626815
Test: Manual & verified that the screenshot tests are passing
RelNote: "Updated the DatePickerColors to include additional
customization options for the date picker divider, navigation, and text
input fields colors."
Change-Id: I1a6856afd9a84e2aec18ece4ed6646b7f4ff4079
M compose/material3/material3/api/public_plus_experimental_current.txt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateInput.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DatePicker.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateRangeInput.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateRangePicker.kt
sg...@google.com <sg...@google.com>
ju...@google.com <ju...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3-android:1.2.0-alpha02
Description
Unable to change the color of divider and year picker menu button along with its border. Which is by default MaterialTheme.colorScheme.onSurfaceVariant.
Expected:
Property for divider and year picker menu button should be exposed or divider can be tied down to title color property and year picker menu button might be tied down to currentYearContentColor.
I have attached the image of date picker.
Also I have attached the screenshot of code where the problem seems to be there.