Status Update
Comments
ma...@google.com <ma...@google.com>
sg...@google.com <sg...@google.com>
ap...@google.com <ap...@google.com> #2
Branch: androidx-main
commit 686984b2d6b236606b16e8ce7ff902b847f3ef55
Author: Shalom Gibly <sgibly@google.com>
Date: Wed Feb 01 14:26:14 2023
Adds a Material 3 DateRangePicker API
- Added DateRangePicker to allow selecting a range of dates.
- Updated the previous DatePicker intenral functionality to support
range selection mode, especially around the Month and Day internal
composables.
- Created a DateRangePickerDefaults and composables for providing title
and headline defaults.
- Changes to the height restriction of the header part of the pickers.
We now set the height from the tokens only when a `title` is provided.
The height is also set as `minHeight` to allow more customization on
the dev-side when providing titles and headlines.
- Added tests
Bug: 245821979
Bug: 267194809
Test: DateRangePickerTest, DateRangePickerScreenshotTest
Relnote: "Added a Material 3 DateRangePicker API for selecting a range of dates."
Change-Id: I7a6c3bd20c0330eec911786619dcc7b86c3dad04
M compose/material3/material3/api/public_plus_experimental_current.txt
M compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Examples.kt
M compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/DatePickerSamples.kt
A compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DateRangePickerScreenshotTest.kt
M compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DateRangePickerTest.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/Strings.android.kt
M compose/material3/material3/src/androidMain/res/values/strings.xml
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DatePicker.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateRangePicker.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Strings.kt
M compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material/Strings.desktop.kt
sg...@google.com <sg...@google.com> #3
Made a change that will collapse the height if the provided optional title
is null
.
This component follows the Material spec, so a headline
should still be provided to display the selected date. You can provide an empty headline
, but a Divider
and some padding will still appear on the top, so we recommend providing the default.
Resolving this ticket as fixed.
na...@google.com <na...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3:1.1.0-alpha07
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit 76627d4fa38dfeb93252e1bdbcb0b43712f437f7
Author: Shalom Gibly <sgibly@google.com>
Date: Tue Mar 07 14:13:28 2023
Adds support for headless date pickers
- Allow null headline composable at the DatePicker and the
DateRangePicker.
- Draw a Divider between the header part and the calendar/date-input
part only when the title and the headline were null, and when the
showModeToggle was false.
- Since the title part is setting the top padding for the DatePicker,
note that when removing it, the resposibility for setting a reasonable
top padding is on the developer.
Bug: 266132421
Bug: 267194809
Test: updated screenshot tests in the topic
Relnote: "Added support for displaying the date pickers without the
header part. API changes to allow passing a null headline when creating
a date picker. You can now pass null headline, title, and showToggleMode
= false in order to display a headless picker."
Change-Id: Id3f3a800c84c12f7c96a3654e59258933da0ec0b
M compose/material3/material3/api/public_plus_experimental_current.txt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DatePicker.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateRangePicker.kt
sg...@google.com <sg...@google.com> #6
Extended the support for "headless" date pickers with the fix for
You can now pass nulls
to the title
and headline
, and false
to the showModeToggle
, to completely eliminate the header and the divider part above the calendar.
pr...@google.com <pr...@google.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3:1.1.0-beta01
sh...@gmail.com <sh...@gmail.com> #8
2. Then, you need to put 'false' in the showModeToggle parameter.
Compose:
DatePicker(
state = rememberDatePickerState(),
modifier = Modifier.fillMaxWidth(),
title = null,
headline = null,
showModeToggle = false
)
Hope you'll find the full answer here:
Description
Jetpack Compose component used: DatePicker from androidx.compose.material3:material3:1.1.0-alpha05
Android Studio Build: #AI-221.6008.13.2211.9477386, built on January 11, 2023
Kotlin version: 1.8.0
Code Sample to Reproduce:
DatePicker(
datePickerState = rememberDatePickerState(),
title = {},
headline = {},
modifier = Modifier.background(Color.Red),
)