Compose Material
androidx.compose.material
androidx.compose.material.icons
(See the API reference docs for all compose packages)
Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |
---|---|---|---|---|
August 7, 2024 | 1.6.8 | - | 1.7.0-beta07 | - |
Structure
Compose is combination of 7 Maven Group Ids within androidx
. Each Group
contains a targeted subset of functionality, each with its own set of release
notes.
This table explains the groups and links to each set of release notes.
Group | Description |
---|---|
compose.animation | Build animations in their Jetpack Compose applications to enrich the user experience. |
compose.compiler | Transform @Composable functions and enable optimizations with a Kotlin compiler plugin. |
compose.foundation | Write Jetpack Compose applications with ready to use building blocks and extend foundation to build your own design system pieces. |
compose.material | Build Jetpack Compose UIs with ready to use Material Design Components. This is the higher level entry point of Compose, designed to provide components that match those described at www.material.io. |
compose.material3 | Build Jetpack Compose UIs with Material Design 3 Components, the next evolution of Material Design. Material 3 includes updated theming and components and Material You personalization features like dynamic color, and is designed to be cohesive with the new Android 12 visual style and system UI. |
compose.runtime | Fundamental building blocks of Compose's programming model and state management, and core runtime for the Compose Compiler Plugin to target. |
compose.ui | Fundamental components of compose UI needed to interact with the device, including layout, drawing, and input. |
Declaring dependencies
To add a dependency on Compose, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.
Add the dependencies for the artifacts you need in the build.gradle
file for
your app or module:
Groovy
dependencies { implementation "androidx.compose.material:material:1.6.8" } android { buildFeatures { compose true } composeOptions { kotlinCompilerExtensionVersion = "1.5.15" } kotlinOptions { jvmTarget = "1.8" } }
Kotlin
dependencies { implementation("androidx.compose.material:material:1.6.8") } android { buildFeatures { compose = true } composeOptions { kotlinCompilerExtensionVersion = "1.5.15" } kotlinOptions { jvmTarget = "1.8" } }
For more information about dependencies, see Add build dependencies.
Feedback
Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.
See the Issue Tracker documentation for more information.
Version 1.7
Version 1.7.0-beta07
August 7, 2024
androidx.compose.material:material-*:1.7.0-beta07
is released. Version 1.7.0-beta07 contains these commits.
Version 1.7.0-beta06
July 24, 2024
androidx.compose.material:material-*:1.7.0-beta06
is released. Version 1.7.0-beta06 contains these commits.
Version 1.7.0-beta05
July 10, 2024
androidx.compose.material:material-*:1.7.0-beta05
is released. Version 1.7.0-beta05 contains these commits.
Version 1.7.0-beta04
June 26, 2024
androidx.compose.material:material-*:1.7.0-beta04
is released. Version 1.7.0-beta04 contains these commits.
Version 1.7.0-beta03
June 12, 2024
androidx.compose.material:material-*:1.7.0-beta03
is released. Version 1.7.0-beta03 contains these commits.
Version 1.7.0-beta02
May 29, 2024
androidx.compose.material:material-*:1.7.0-beta02
is released. Version 1.7.0-beta02 contains these commits.
API Changes
- Update API for styling the links: moved the
TextLinkStyles
to theTextStyle
and removed theTextDefaults
from material (I5477b)
Version 1.7.0-beta01
May 14, 2024
androidx.compose.material:material-*:1.7.0-beta01
is released. Version 1.7.0-beta01 contains these commits.
API Changes
- Updated the API for getting Material themed links in Text. Specifically, removed the methods from the
TextDefaults
for constructing themedLinkAnnotations
and parse HTML with themed links. Instead, added aTextLinkStyles
class that allows to style the links as a parameter to the Text composable. (I31b93)
Version 1.7.0-alpha08
May 1, 2024
androidx.compose.material:material-*:1.7.0-alpha08
is released. Version 1.7.0-alpha08 contains these commits.
API Changes
- Fix
backgroundColor
not applying toTextFieldDecorationBox
andOutlinedTextFieldDecorationBox
. Decoration boxes now accept ashape
parameter. (I371c2, b/307694651) RippleConfiguration#isEnabled
has been removed, andLocalRippleConfiguration
has been made nullable. To disable a ripple, instead of providing aRippleConfiguration
withisEnabled = false
, providenull
toLocalRippleConfiguration
. (I22725)- Text links have a pressed state styling option in addition to normal styling, hovered and focused.
TextDefaults
methods each have apressedStyle
argument to support that. (Ic473f, b/139312671)
Bug Fixes
OutlinedTextField
top padding for label now accounts for system font size. (Idc781)
Version 1.7.0-alpha07
April 17, 2024
androidx.compose.material:material-*:1.7.0-alpha07
is released. Version 1.7.0-alpha07 contains these commits.
API Changes
- Text links got pressed state styling option in addition to normal styling, hovered and focused. (I5f864, b/139312671)
- Added a
TextDefaults
object that contains methods to construct aLinkAnnotation
and parse HTML-tagged string which applyMaterialTheme
to the links. (I98532, b/139312671)
Version 1.7.0-alpha06
April 3, 2024
androidx.compose.material:material-*:1.7.0-alpha06
is released. Version 1.7.0-alpha06 contains these commits.
Announcement
androidx.compose.material
no longer requires using the same version of every artifact is this maven group. Users can mix and match versions of Compose foundation libraries (Ie5fba)
API Changes
- Moved more
ModalDrawer
andBottomDrawer
defaults intoDrawerDefaults
object. (Ib5b2e)
Version 1.7.0-alpha05
March 20, 2024
androidx.compose.material:material-*:1.7.0-alpha05
is released. Version 1.7.0-alpha05 contains these commits.
API Changes
- The
ScaffoldSubcomposeInMeasureFix
flag has been removed. (I67363)
Version 1.7.0-alpha04
March 6, 2024
androidx.compose.material:material-*:1.7.0-alpha04
is released. Version 1.7.0-alpha04 contains these commits.
New Features
- Added a new
androidx.compose.material:material-navigation
artifact that adds support for bottom sheets as destinations when using Navigation Compose. This replaces the Accompanist Navigation Material library. (d65d57, b/180247978)
Version 1.7.0-alpha03
February 21, 2024
androidx.compose.material:material-*:1.7.0-alpha03
is released. Version 1.7.0-alpha03 contains these commits.
API Changes
BottomDrawer
has been promoted from experimental to stable.BottomDrawerState
now exposes the progress as a function, allowing to query progress between specific targets.BottomDrawerState
now allows customizing the animation spec, andconfirmStateChange
is not a trailing lambda anymore. (I9c029, b/261423850)BackdropScaffold
has been promoted from experimental to stable. The animation spec is now atween
spec in accordance with guidelines. ThesnackbarHost
parameter ofBackdropScaffold
is no longer the last parameter to avoid confusion with trailing lambdas.BackdropScaffoldState
exposes aprogress(from, to)
API to query progress between anchors. (I73f48, b/261423218)- Standard bottom sheets have been promoted from experimental to stable. Deprecated constructors have been removed. The animation spec is now a tween spec in accordance with guidelines. (I3c1a8, b/278692145, b/261409034)
- Modal bottom sheets have been promoted from experimental to stable. Deprecated constructors have been removed. The animation spec is now a
tween
spec in accordance with guidelines. (Ic53f4, b/278692145, b/266780235, b/261409034)
Bug Fixes
- Fixed an issue where
BackdropScaffold
could crash in specific scenarios in combination withLookaheadScope
. (I51396) - Removed subcomposition inside
BottomSheetScaffold
to improve performance. Fixed an issue whereBottomSheetScaffold
would crash in specific scenarios in combination withLookaheadScope
. (I2f90c) - Removed subcomposition inside
ModalBottomSheetLayout
, improving performance. (I7a025)
Version 1.7.0-alpha02
February 7, 2024
androidx.compose.material:material-*:1.7.0-alpha02
is released. Version 1.7.0-alpha02 contains these commits.
Version 1.7.0-alpha01
January 24, 2024
androidx.compose.material:material-*:1.7.0-alpha01
is released. Version 1.7.0-alpha01 contains these commits.
Behavior Changes
- Material components have been migrated to use the new ripple APIs, and no longer query
RippleTheme
.
API Changes
rememberRipple
andRippleTheme
have been deprecated from material-ripple, with new ripple andRippleConfiguration
APIs added to material and other design system libraries.Material components that previously accepted a
MutableInteractionSource
and defaulted to remember{ MutableInteractionSource() }
now accept a nullableMutableInteractionSource
and default to null instead. If you are not hoisting and using theMutableInteractionSource
, you should pass null. This allows for some components to lazily create an instance only when needed, improving performance. It is also recommended that you make similar changes in your own components.
Version 1.6
Version 1.6.8
June 12, 2024
androidx.compose.material:material-*:1.6.8
is released. Version 1.6.8 contains these commits.
Version 1.6.7
May 1, 2024
androidx.compose.material:material-*:1.6.7
is released. Version 1.6.7 contains these commits.
Version 1.6.6
April 17, 2024
androidx.compose.material:material-*:1.6.6
is released. No changes since the last release.
Version 1.6.5
April 3, 2024
androidx.compose.material:material-*:1.6.5
is released. Version 1.6.5 contains these commits.
Version 1.6.4
March 20, 2024
androidx.compose.material:material-*:1.6.4
is released. Version 1.6.4 contains these commits.
Version 1.6.3
March 6, 2024
androidx.compose.material:material-*:1.6.3
is released. Version 1.6.3 contains these commits.
Bug Fixes
- Fix regression in
ExposedDropdownMenu
to make it focusable again. (c0e0ed, b/323694447)
Version 1.6.2
February 21, 2024
androidx.compose.material:material-*:1.6.2
is released. Version 1.6.2 contains these commits.
Version 1.6.1
February 7, 2024
androidx.compose.material:material-*:1.6.1
is released. Version 1.6.1 contains these commits.
Version 1.6.0
January 24, 2024
androidx.compose.material:material-*:1.6.0
is released. Version 1.6.0 contains these commits.
Version 1.6.0-rc01
January 10, 2024
androidx.compose.material:material-*:1.6.0-rc01
is released. Version 1.6.0-rc01 contains these commits.
Version 1.6.0-beta03
December 13, 2023
androidx.compose.material:material-*:1.6.0-beta03
is released. Version 1.6.0-beta03 contains these commits.
Version 1.6.0-beta02
November 29, 2023
androidx.compose.material:material-*:1.6.0-beta02
is released. Version 1.6.0-beta02 contains these commits.
Version 1.6.0-beta01
November 15, 2023
androidx.compose.material:material-*:1.6.0-beta01
is released. Version 1.6.0-beta01 contains these commits.
Version 1.6.0-alpha08
October 18, 2023
androidx.compose.material:material-*:1.6.0-alpha08
is released. Version 1.6.0-alpha08 contains these commits.
API Changes
- Deprecate a
materialIcon
function in favor of its overload that takes anautoMirror
parameter. (Ia338d)
Bug Fixes - Auto-increase height of nav item for large content. (0c4ecc, b/272336962)
Version 1.6.0-alpha07
October 4, 2023
androidx.compose.material:material-*:1.6.0-alpha07
is released. Version 1.6.0-alpha07 contains these commits.
- Dependency updates
Version 1.6.0-alpha06
September 20, 2023
androidx.compose.material:material-*:1.6.0-alpha06
is released. Version 1.6.0-alpha06 contains these commits.
Behavior Breaking Change
- Removed drawer-related functionality from
BottomSheetScaffold
. Wrap yourBottomSheetScaffold
in a Drawer composable to achieve the previous functionality. SeeBottomSheetScaffoldWithDrawerSample
for an example. (I1dcc8)
API Changes
- Introduced a temporary flag to control whether Scaffold should measure its children during measurement or during placement. By default, this will measure in measurement. If you are facing issues with the new behavior, please file an issue. (If6e3b)
Version 1.6.0-alpha05
September 6, 2023
androidx.compose.material:material-*:1.6.0-alpha05
is released. Version 1.6.0-alpha05 contains these commits.
New Features
- Added support for auto-mirrored icons when rendered in right-to-left layouts. Icons in the material-icons-core and material-icons-extended modules are now providing additional icon sets for supporting auto-mirroring when the icon allows it. The new sets are prefixed with
Icons.AutoMirrored.Filled...
etc., and hold icons that will auto-mirror on RTL layouts. See the list of Material icons for the list of icons that can (and should) be auto-mirrored.
API Changes
- Added support for auto-mirrored icons when rendered in right-to-left layouts. Icons in the material-icons-core and material-icons-extended modules are now providing additional icon sets for supporting auto-mirroring when the icon allows it. The new sets are prefixed with
Icons.AutoMirrored.Filled...
etc., and hold icons that will auto-mirror on RTL layouts. See the list of Material icons for the list of icons that can (and should) be auto-mirrored. The previously provided icon properties for those icons are now marked as deprecated, and provides a replacement-block suggestion to help with the migration. In case you don't have any special handling for mirroring icons on RTL, we recommend migrating to the new set of icons. For example,Icons.Filled.ArrowBack
should be refactored toIcons.AutoMirrored.Filled.ArrowBack
. (I4b511)
Version 1.6.0-alpha04
August 23, 2023
androidx.compose.material:material-*:1.6.0-alpha04
is released. Version 1.6.0-alpha04 contains these commits.
Bug Fixes
- Fixed an issue where some components using
Subcomposition
(e.g.BottomSheetScaffold
) inside a Scaffold inside aLookaheadScope
were attempting to read their size too early. (If2c5d) - Fixed
DropdownMenu
'soffset
calculation so x offsets depend solely on the local layout direction, and y offsets will no longer be reversed when the menu is near the bottom of the screen. (Iccc74, b/294103942) - Optimized
BottomSheetScaffold
's layout internals and fixed a potential issue withBottomSheetScaffold
inside aLookaheadLayout
. (Ic0afa)
Version 1.6.0-alpha03
August 9, 2023
androidx.compose.material:material-*:1.6.0-alpha03
is released. Version 1.6.0-alpha03 contains these commits.
API Changes
- Material2 components now have a separate API to pass
windowInsets
to support edge-to-edge functionality in android. Unlike material3 components, material2 components do not support insets by default and the value should be passed manually. Refer to the corresponding samples for guidance. (I655e8)
Version 1.6.0-alpha02
July 26, 2023
androidx.compose.material:material-*:1.6.0-alpha02
is released. Version 1.6.0-alpha02 contains these commits.
API Changes
- We are moving the density dependency to the component level. This applies to the following components:
SwipeToDismiss
and Sheet based components. Please use the new overload provided where density is a parameter. (I1846e) - Additional annotations to specify allowed inputs to composables (I51109)
- Updated API files to annotate compatibility suppression (I8e87a, b/287516207)
- Added new Start alignment for
FabPosition
(Ib7aea, b/170592777) TextFieldColorsWithIcons
in Material 2 has been deprecated in favor ofTextFieldColors
. When overridingleadingIconColor
ortrailingIconColor
, also override the overload withinteractionSource
. (Id57ed, b/199377790)
Version 1.6.0-alpha01
June 21, 2023
androidx.compose.material:material-*:1.6.0-alpha01
is released. Version 1.6.0-alpha01 contains these commits.
Behavior Changes
includeFontPadding
is nowfalse
by default in Material 2 typography. The default line height style has also been changed toTrim.None
andAlignment.Center
, and explicitlineHeight
(in sp) have been added to theTextStyle
s ofTypography
. Consult the API docs if you want to customize these values, and see the blog post for an in-depth explainer of these changes. (Icabc3, I3f801, I04c03)
API Changes
- Material's
Swipeable
APIs have been deprecated. Please refer to Foundation'sAnchoredDraggable
APIs which are optimized for both simple and complex use cases. (I732e0)
Bug Fixes
BottomSheetState
,ModalBottomSheetState
andBottomDrawerState
now expose a progress property indicating the progress between the current (settled) anchor and the closest anchor in the swipe direction. (I1b317, b/271169225, b/276375124, b/276776071, b/270066861)
Version 1.5
Version 1.5.4
October 18, 2023
androidx.compose.material:material-*:1.5.4
is released. Version 1.5.4 contains these commits.
Version 1.5.3
October 4, 2023
androidx.compose.material:material-*:1.5.3
is released. This version does not have any changes
Version 1.5.2
September 27, 2023
androidx.compose.material:material-*:1.5.2
is released. Version 1.5.2 contains these commits.
Version 1.5.1
September 6, 2023
androidx.compose.material:material-*:1.5.1
is released with no changes. Version 1.5.1 contains these commits.
Version 1.5.0
August 9, 2023
androidx.compose.material:material-*:1.5.0
is released. Version 1.5.0 contains these commits.
Important changes since 1.4.0
API Changes
- Incorporated changes in the Swipeable1 APIs in
BottomSheetScaffold
.BottomSheetState
'sconfirmStateChange
param has been renamed toconfirmValueChange
.progress
is now exposed as a float value.animateTo
andsnapTo
are internal. Useexpand()
andcollapse()
instead.direction
andoverflow
have been removed.offset
has been replaced withrequireOffset()
. I323b4 - Mark the
snapTo
function in Drawer as non-experimental API. (Ib9c18, b/261425368) - Added a track color parameter for circular progress indicators, and a stroke cap parameter for both circular and linear progress indicators. (Ie668c, b/216325962, b/222964817)
- Renamed
ModalBottomSheetState
,ModalBottomSheetState.Saver
andrememberModalBottomSheetState
'sconfirmStateChange
toconfirmValueChange
. (Ib48d1) - Add
Modifier.minimumInteractiveComponentSize
. It can be used to reserve at least 48.dp in size to disambiguate touch interactions if the element would measure smaller. (I33f58, b/258495559) - Incorporated changes in the Swipeable APIs in
ModalBottomSheetLayout
.ModalBottomSheetState
's animateTo does not take ananimationSpec
parameter anymore and the offset exposed is now nullable. UserequireOffset
to require the offset. (Ia2e79) - Adding
@JvmDefaultWithCompatibility
annotation (I8f206) - Incorporated changes in the Swipeable APIs in
ModalDrawer. DrawerState
'sanimateTo
has been replaced by the open and close methods and the offset is now nullable. UserequireOffset
to require the offset. (I3de9e) - Updated Drawers and Sheets to correctly delay presses in case gestures can become scroll events.
- Added
minLines
parameter into material and material3 Text,TextField
andOutlinedTextField
which allows setting the minimum height of the component in terms of number of lines (I4af1d)
Bug Fixes
- Fixes an issue where
pullRefresh
was not consuming velocity, causing overscroll to show. Also changed the API signature of theonRelease
lambda inModifier.pullRefresh
to return a Float for consumed velocity (I7db65, b/266874741) BottomSheetState
,ModalBottomSheetState
andBottomDrawerState
now expose a progress property indicating the progress between the current (settled) anchor and the closest anchor in the swipe direction. (I1b317, b/271169225, b/276375124, b/276776071, b/270066861)- Fixed the
AlertDialog
dismiss action to appear below the confirm action when the actions stacked over each other to fit into the dialog's width. This fix aligns the implementation with the Material Design spec. (I029de, b/235454277) BottomSheetScaffold
will not participate in nested scroll anymore whengesturesEnabled
is set to false. (I634f3, b/215403277)- Fixed a bug where
BottomSheetScaffold
would crash when provided with empty content for slots. (Ib24a5, b/235588730) - Fixes
PullRefreshIndicator
intercepting clicks/pointer events. (2494256, b/271777421) - Fixed an issue where
ModalBottomSheetLayout
would crash in an edge case on orientation change. Layout animations (e.g.Modifier.animateContentSize
) in/on the sheet content now work smoothly. (I2f981, b/266780234)
Version 1.5.0-rc01
July 26, 2023
androidx.compose.material:material-*:1.5.0-rc01
is released. Version 1.5.0-rc01 contains these commits.
Version 1.5.0-beta03
June 28, 2023
androidx.compose.material:material-*:1.5.0-beta03
is released. Version 1.5.0-beta03 contains these commits.
Bug Fixes
BottomSheetState
,ModalBottomSheetState
andBottomDrawerState
now expose a progress property indicating the progress between the current (settled) anchor and the closest anchor in the swipe direction. (I1b317, b/271169225, b/276375124, b/276776071, b/270066861)
Version 1.5.0-beta02
June 7, 2023
androidx.compose.material:material-*:1.5.0-beta02
is released. Version 1.5.0-beta02 contains these commits.
Version 1.5.0-beta01
May 24, 2023
androidx.compose.material:material-*:1.5.0-beta01
is released. Version 1.5.0-beta01 contains these commits.
API Changes
DrawerState
's andBottomDrawerState
's offset are not nullable anymore. They instead returnFloat.NaN
to indicate the absence of the offset. (Ie9855)- Added an option to pass in a
ScrollState
when constructing aDropdownMenu
or anExposedDropdownMenu
for controlling the vertical scroll state of the displayed menu items. (Idb009, b/185304441) - Add the support for enabling/disabling the gesture of
ModalBottomSheetLayout
so that user could configure this for more featured bottomsheet (I40af0) - Added a color parameter to
BasicText
to allow efficiently animating or setting text color. (Iffd88, b/246961787) - Renaming the Semantics property
isContainer
toisTraversalGroup
(I121f6)
Bug Fixes
- Fixed the
AlertDialog
dismiss action to appear below the confirm action when the actions stacked over each other to fit into the dialog's width. This fix align the implementation with the Material Design spec. (I029de, b/235454277)
Version 1.5.0-alpha04
May 10, 2023
androidx.compose.material:material-*:1.5.0-alpha04
is released. Version 1.5.0-alpha04 contains these commits.
API Changes
- We are moving the density dependency to the component level. This applies to the following components:
BottomDrawer
,ModalBottomSheetLayout
,BottomSheetScaffold
,Switch
,ModalDrawer
. Please use the new overload provided where density is a parameter. (I8fbd8)
Version 1.5.0-alpha03
April 19, 2023
androidx.compose.material:material-*:1.5.0-alpha03
is released. Version 1.5.0-alpha03 contains these commits.
API Changes
- Update
BottomDrawer
internals to use the newSwipeableV2
APIs. Because of thisBottomDrawerState
will now only have APIS defined at the class level, it won't inherit methods/properties fromSwipeableState
. We're using composition with an internalSwipeableV2State
. Offset is now a nullable floating point property, the current value and a swipe target value can still be accessed through currentValue and targetValue properties. The previous class level methods such as open/expand/close and properties such asisOpen/isClosed
continue to be supported. (Iad40c, b/178529942, b/220676296)
Bug Fixes
- Updated internals of the Switch component. The switch will now preview the closest (target state) when dragging. (Id90d4)
- Animated sheet content (e.g.
Modifier.animateContentSize
on sheet content) inBottomSheetScaffold
has been optimized and now works smoothly. (Ia913c, b/270518202, b/254446195) BottomSheetScaffold
will not participate in nested scroll anymore whengesturesEnabled
is set tofalse
. (I634f3, b/215403277)
Version 1.5.0-alpha02
April 5, 2023
androidx.compose.material:material-*:1.5.0-alpha02
is released. Version 1.5.0-alpha02 contains these commits.
Bug Fixes
- Fixed a bug where
BottomSheetScaffold
would crash when provided with empty content for slots. (Ib24a5, b/235588730) - Fixes
PullRefreshIndicator
intercepting clicks / pointer events (2494256, b/271777421)
Version 1.5.0-alpha01
March 22, 2023
androidx.compose.material:material-*:1.5.0-alpha01
is released. Version 1.5.0-alpha01 contains these commits.
Bug Fixes
- Add a chipgroup reflow sample. Update the horizontal padding in between child chips in the single line chipgroup sample to match spec. (I3b155)
- Fixed an issue where
ModalBottomSheetLayout
would crash in an edge case on orientation change. Layout animations (e.g.Modifier.animateContentSize
) in/on the sheet content now work smoothly. (I2f981, b/266780234)
Version 1.4
Version 1.4.3
May 3, 2023
androidx.compose.material:material-*:1.4.3
is released with no changes (only a version bump).
Version 1.4.2
April 19, 2023
androidx.compose.material:material-*:1.4.2
is released. Version 1.4.2 contains these commits.
Version 1.4.1
April 5, 2023
androidx.compose.material:material-*:1.4.1
is released. Version 1.4.1 contains these commits.
Version 1.4.0
March 22, 2023
androidx.compose.material:material-*:1.4.0
is released. Version 1.4.0 contains these commits.
Important changes since 1.3.0
API Changes
- Add
Modifier.minimumInteractiveComponentSize
. It can be used to reserve at least 48.dp in size to disambiguate touch interactions if the element would measure smaller. (I33f58, b/258495559) - Incorporated changes in the Swipeable APIs in
ModalDrawer
.DrawerState
'sanimateTo
has been replaced by the open and close methods and the offset is now nullable. UserequireOffset
to require the offset. (I3de9e) - Added
minLines
parameter into material and material3 Text,TextField
andOutlinedTextField
which allows setting the minimum height of the component in terms of number of lines (I4af1d) - Added
minLines
parameter to theBasicText
andBasicTextField
. It allows to set the minimum height of these composables in terms of number of lines (I24294, b/122476634)
Version 1.4.0-rc01
March 8, 2023
androidx.compose.material:material-*:1.4.0-rc01
is released with no changes. Version 1.4.0-rc01 contains these commits.
Version 1.4.0-beta02
February 22, 2023
androidx.compose.material:material-*:1.4.0-beta02
is released. Version 1.4.0-beta02 contains these commits.
API Changes
- Incorporated changes in the Swipeable APIs in
BottomSheetScaffold
.BottomSheetState
'sconfirmStateChange
param has been renamed toconfirmValueChange
.progress
is now exposed as a float value.animateTo
andsnapTo
are internal. Useexpand()
andcollapse()
instead.direction
andoverflow
have been removed.offset
has been replaced withrequireOffset()
. (I323b4)
Bug Fixes
- Removed semantic roles from clickable and selectable surfaces, updated components that used them to set roles using modifier.semantics (Ibb4ba)
- Minor update to the extended Material icons that tweaks the filled
desktop_mac
,directions
, andkitchen
icons. (I65f5e)
Version 1.4.0-beta01
February 8, 2023
androidx.compose.material:material-*:1.4.0-beta01
is released. Version 1.4.0-beta01 contains these commits.
API Changes
- Fixes an issue where
pullRefresh
was not consuming velocity, causing overscroll to show. Also changed the API signature of theonRelease
lambda inModifier.pullRefresh
to return a Float for consumed velocity (I7db65, b/266874741) - Restored property getter
LocalMinimuTouchTargetEnforcement
and mark it as deprecated and redirect toLocalMinimumInteractiveComponentEnforcement
. (I60dd5)
Version 1.4.0-alpha05
January 25, 2023
androidx.compose.material:material-*:1.4.0-alpha05
is released. Version 1.4.0-alpha05 contains these commits.
Bug Fixes
- Fixed an issue where
ModalBottomSheetLayout's HalfExpanded
state was calculated incorrectly and the sheet would appear to be floating. (I8c615, b/265610459) - Fixed a bug in
ModalBottomSheetLayout
where the sheet would crash when going from the hidden to a visible state in some circumstances. (Ia9265, b/265444789)
Version 1.4.0-alpha04
January 11, 2023
androidx.compose.material:material-*:1.4.0-alpha04
is released. Version 1.4.0-alpha04 contains these commits.
API Changes
- Added in
IsContainer
semantics property on Surfaces. This property will be used in a later change that determines traversal order based on the semantic meaning of elements such as surfaces. (I63379) - Mark the
snapTo
function in Drawer as non-experimental API. (Ib9c18, b/261425368) - Added a track color parameter for circular progress indicators, and a stroke cap parameter for both circular and linear progress indicators. (Ie668c, b/216325962, b/222964817)
- Renamed
ModalBottomSheetState
,ModalBottomSheetState.Saver
andrememberModalBottomSheetState
'sconfirmStateChange
toconfirmValueChange
. (Ib48d1) - More return type nullability of deprecated-hidden functions (Ibf7b0)
- Add
Modifier.minimumInteractiveComponentSize
. It can be used to reserve at least 48.dp in size to disambiguate touch interactions if the element would measure smaller. (I33f58, b/258495559) - Incorporated changes in the Swipeable APIs in
ModalBottomSheetLayout
.ModalBottomSheetState
'sanimateTo
does not take ananimationSpec
parameter anymore and theoffset
exposed is now nullable. UserequireOffset
to require theoffset
. (Ia2e79)
Bug Fixes
- A
ModalBottomSheetLayout
's sheet now has a maximum width of 640 dp. (I71a4f, b/234927577) - Fixes an issue where
rememberPullRefreshState
was not updatingrefreshThreshold
andrefreshingOffset
over time. (Ifed10, b/263159832) - Progress for progress indicators is now properly bounded to its expected range. (I8a7eb, b/262262727)
- When
ModalBottomSheetState
has not received any anchors yet, it will update thecurrentValue
without an animation whensnapTo
oranimateTo
are called instead of throwing an exception. (I2c91b) - Fixed the enabled state at the Material 2
FilterChip
implementation. (Id326a, b/261329817) - Fixed a bug where
ModalBottomSheetLayout
would crash if it wasHalfExpanded
when rotating from portrait to landscape. Please ensure you are passing in the correctinitialValue
, for example by checking the configuration. (Ie8df7, b/182882364) - Fixed an issue where
ModalBottomSheetLayout
would crash if the sheet content was empty.ModalBottomSheetLayout
now allows empty sheet content. If the sheet content is empty, it will only have a Hidden state. (Ic2288, b/200980998, b/216693030)
Known Issue
- When updating from
androidx.compose.foundation:1.4.0-alpha03
toandroidx.compose.foundation:1.4.0-alpha04
, you might experience ajava.lang.NoSuchFieldError
error. Here is where the issue was orginially reported. A fix has been submitted, and will be available on the next Compose update. As a work around, update yourandroidx.compose.material
andandroidx.compose.material3
libraries to the latest version(1.1.0-alpha04) or downgrade yourandroidx.compose.foundation
to 1.4.0-alpha03.
Version 1.4.0-alpha03
December 7, 2022
androidx.compose.material:material-*:1.4.0-alpha03
is released. Version 1.4.0-alpha03 contains these commits.
API Changes
- Adding
@JvmDefaultWithCompatibility
annotation (I8f206) - Incorporated changes in the
Swipeable
APIs inModalDrawer
.DrawerState
'sanimateTo
has been replaced by theopen
andclose
methods and the offset is now nullable. UserequireOffset
to require the offset. (I3de9e) - Added an Modifier API to query ancestors scroll info. (I2ba9d, b/203141462)
- Used in
Clickable
to correctly delay press interactions, when gestures could become scroll events. - Fixed
Clickables
not correctly delaying ripples, when used inside anScrollable ViewGroup
. - Updated Drawers and Sheets to correctly delay presses in case gestures can become scroll events.
Bug Fixes
- Fixed an issue where
PullRefreshIndicator
could get stuck afteronRefresh
is called, if the refreshing state was not changed to true. (Ie2416, b/248274004)
Dependency Updates
- Compose UI and Compose Material now depend on Lifecycle 2.5.1. (I05ab0, b/258038814)
Version 1.4.0-alpha02
November 9, 2022
androidx.compose.material:material-*:1.4.0-alpha02
is released. Version 1.4.0-alpha02 contains these commits.
API Changes
awaitFirstDown
andwaitForUpOrCancellation
now accept aPointerEventPass
for greater flexibility. (I7579a, b/212091796)- Added
minLines
parameter into material and material3 Text,TextField
andOutlinedTextField
which allows setting the minimum height of the component in terms of number of lines (I4af1d) - Added
minLines
parameter to theBasicTex
t andBasicTextField
. It allows to set the minimum height of these composables in terms of number of lines (I24294, b/122476634)
Version 1.4.0-alpha01
October 24, 2022
androidx.compose.material:material-*:1.4.0-alpha01
is released. Version 1.4.0-alpha01 contains these commits.
API Changes
- A new method,
awaitEachGesture()
, for gesture detectors was added. It operates similar toforEachGesture()
, but the loop over gestures operates entirely within theAwaitPointerEventScope
so events can't be lost between iterations. forEachGesture()
has been deprecated in favor ofawaitEachGesture()
because it allows events to be lost between gestures. (Iffc3f, b/251260206)
Version 1.3
Version 1.3.1
November 9, 2022
androidx.compose.material:material-*:1.3.1
is released. Version 1.3.1 contains these commits.
Version 1.3.0
October 24, 2022
androidx.compose.material:material-*:1.3.0
is released. Version 1.3.0 contains these commits.
Important changes since 1.2.0
Behavior breaking change
- Maximum supported elevation in dialogs and popups has been reduced to 8dp.
API Changes
- Add a Pull-To-Refresh component to Compose (I29168).
- Change parameter name from values to value in RangeSlider (I3b79a).
Version 1.3.0-rc01
October 5, 2022
androidx.compose.material:material-*:1.3.0-rc01
is released. Version 1.3.0-rc01 contains these commits.
Version 1.3.0-beta03
September 21, 2022
androidx.compose.material:material-*:1.3.0-beta03
is released. Version 1.3.0-beta03 contains these commits.
API Changes
- Add a Pull-To-Refresh component to Compose (I29168)
Version 1.3.0-beta02
September 7, 2022
androidx.compose.material:material-*:1.3.0-beta02
is released. Version 1.3.0-beta02 contains these commits.
No changes since 1.3.0-beta01
Version 1.3.0-beta01
August 24, 2022
androidx.compose.material:material-*:1.3.0-beta01
is released. Version 1.3.0-beta01 contains these commits.
Behavior breaking change
Maximum supported elevation in dialogs and popups has been reduced to 8dp.
The maximum supported elevation for Compose dialogs and popups has been reduced from 30dp to 8dp. This change affects both material and ui custom dialogs and popups. This change is made to mitigate an accessibility bug on Android versions below S, and to ensure that accessibility services within those windows are able to interact with the content inside the dialog or popup.
You will only be impacted by this change if you are creating a custom dialog or popup implementation with an elevation set to levels higher than 8dp. Consider lowering the elevation of your dialog or popup. If you need to opt-out from this new behavior, consider forking your own dialog or popup with the desired elevation set. This is not recommended, as accessibility might be negatively impacted and it is on the developer to ensure the bottom part of the dialog or popup is interactable and readable by accessibility services.
Version 1.3.0-alpha03
August 10, 2022
androidx.compose.material:material-*:1.3.0-alpha03
is released. Version 1.3.0-alpha03 contains these commits.
Version 1.3.0-alpha02
July 27, 2022
androidx.compose.material:material-*:1.3.0-alpha02
is released. Version 1.3.0-alpha02 contains these commits.
External Contribution
- Fix
AnimatedVisibility
issue withFloatingActionButton
in Scaffold (I3a0ae, b/224005027)
Version 1.3.0-alpha01
June 29, 2022
androidx.compose.material:material-*:1.3.0-alpha01
is released. Version 1.3.0-alpha01 contains these commits.
API Changes
- Change parameter name from values to value in
RangeSlider
(I3b79a)
Bug Fixes
- Update badge sample to provide more meaningful content description. (I10b9d)
Version 1.2
Version 1.2.1
August 10, 2022
androidx.compose.material:material-*:1.2.1
is released. Version 1.2.1 contains these commits.
Version 1.2.0
July 27, 2022
androidx.compose.material:material-*:1.2.0
is released. Version 1.2.0 contains these commits.
Version 1.2.0-rc03
June 29, 2022
androidx.compose.material:material-*:1.2.0-rc03
is released. Version 1.2.0-rc03 contains these commits.
- No changes since 1.2.0-rc02.
Version 1.2.0-rc02
June 22, 2022
androidx.compose.material:material-*:1.2.0-rc02
is released. Version 1.2.0-rc02 contains these commits.
Version 1.2.0-rc01
June 15, 2022
androidx.compose.material:material-*:1.2.0-rc01
is released. Version 1.2.0-rc01 contains these commits.
API Changes
- Interfaces in compose libraries are now built using jdk8 default interface methods (I5bcf1)
Bug Fixes
- Updates badge with leading icon tab to affix badge to the label instead of the icon. (I90993)
Version 1.2.0-beta03
June 1, 2022
androidx.compose.material:material-*:1.2.0-beta03
is released. Version 1.2.0-beta03 contains these commits.
Bug Fixes
- Fixed a bug where
BottomSheetScaffold
was drawing over the top app bar's shadow.BottomSheetScaffold
now also takes the sheet's state into account when placing Snackbars: in the collapsed state, Snackbars are placed above the sheet and FAB; in the expanded state, Snackbars are anchored to the sheet's bottom. (Ia80b5, b/187771422)
Version 1.2.0-beta02
May 18, 2022
androidx.compose.material:material-*:1.2.0-beta02
is released. Version 1.2.0-beta02 contains these commits.
Version 1.2.0-beta01
May 11, 2022
androidx.compose.material:material-*:1.2.0-beta01
is released. Version 1.2.0-beta01 contains these commits.
New Features
- This is the first beta release of 1.2!
API Changes
- Renamed
TextFieldDefaults.BorderStroke
composable that draws a border stroke inOutlinedTextField
toTextFieldDefaults.BorderBox
. (I5f295)
Version 1.2.0-alpha08
April 20, 2022
androidx.compose.material:material-*:1.2.0-alpha08
is released. Version 1.2.0-alpha08 contains these commits.
API Changes
- Partial consumption (down OR position) has been deprecated in
PointerInputChange
. You can useconsume()
to consume the change completely. You can useisConsumed
to determine whether or not someone else has previously consumed the change. PointerInputChange::copy()
now always makes a shallow copy. It means that copies ofPointerInputChange
will be consumed once one of the copies is consumed. If you want to create an unboundPointerInputChange
, use constructor instead. (Ie6be4, b/225669674)
Version 1.2.0-alpha07
April 6, 2022
androidx.compose.material:material-*:1.2.0-alpha07
is released. Version 1.2.0-alpha07 contains these commits.
Version 1.2.0-alpha06
March 23, 2022
androidx.compose.material:material-*:1.2.0-alpha06
is released. Version 1.2.0-alpha06 contains these commits.
API Changes
- Updates to the clickable Card API to follow changes at the Surface API (I56bcb)
- Updates to Material 2 Surface API that adds additional overloaded functions for selectable and toggleable Surfaces. (Ifcca5)
Version 1.2.0-alpha05
March 9, 2022
androidx.compose.material:material-*:1.2.0-alpha05
is released. Version 1.2.0-alpha05 contains these commits.
API Changes
LazyVerticalGrid
andLazyHorizontalGrid
are now stable. (I307c0)LazyVerticalGrid/LazyHorizontalGrid
and all related apis were moved into .grid subpackage. Please update your imports from androidx.compose.foundation.lazy to androidx.compose.foundation.lazy.grid. (I2d446, b/219942574)- Reverted previous change of relying solely on a View for
WindowInsetsControllerCompat
, and again require a Window which is required for managing some window flags. DeprecatedViewCompat.getWindowInsetsController
in favor ofWindowCompat.getInsetsController
to ensure that the correct Window is used (such as if the View is in a dialog). (I660ae, b/219572936) - Text:
includeFontPadding
is now turned off by default. The clipping issues as a result ofincludeFontPadding=false
is handled and no clipping should occur for tall scripts. (I31c84, b/171394808) - Added a new
LazyVerticalGrid
API to define cross axis sizes (I17723)
Version 1.2.0-alpha04
February 23, 2022
androidx.compose.material:material-*:1.2.0-alpha04
is released. Version 1.2.0-alpha04 contains these commits.
API Changes
Add support for filter chips
(I39a6e, b/192585545)- Added
TextFieldDecorationBox
andOutlinedTextFieldDecorationBox
. Using them together withBasicTextField
will help you build custom text field based on Material Design text fields but with more options for customisation. - Provided a way to adjust horizontal and vertical paddings in text fields. (I8c9f1, b/203764564, b/191543915, b/189971673, b/183136600, b/179882597, b/168003617)
Added
ComposableTarget
,ComposableTargetMarker
andComposableOpenTarget
that allows compile time reporting of when a composable function is called targeting an applier it was not designed to use.In most cases the annotations can be inferred by the compose compiler plugin so using these annotation directly should be rare . The cases that cannot be inferred include creating and using a custom applier, abstract composable functions (such as interface methods), fields or global variables that are composable lambdas (local variables and parameters are inferred), or when using
ComposeNode
or a related composable functions.For custom appliers the composable functions that calls
ComposeNode
orReusableComposeNode
need to add aCompoableTarget
annotation for the function and any composable lambda parameter types. It is recommended, however, to create an annotation that is annotated withComposableTargetMarker
and then the marked annotation be used instead ofComposableTarget
directly. A composable annotation marked withComposableTargetMarker
is equivalent to aComposbleTarget
with the fully qualified name of the attribute class as the applier parameter. For an example of usingComposableTargetMarker
seeanroidx.compose.ui.UiComposable
. (I38f11)
Version 1.2.0-alpha03
February 9, 2022
androidx.compose.material:material-*:1.2.0-alpha03
is released. Version 1.2.0-alpha03 contains these commits.
Bug Fixes
- Addes chip group sample (I97080, b/192585545)
Version 1.2.0-alpha02
January 26, 2022
androidx.compose.material:material-*:1.2.0-alpha02
is released. Version 1.2.0-alpha02 contains these commits.
API Changes
- Added
NonRestartableComposable
to methods that are overloads of existing methods without complex logic. This reduces compiler generated memoization checks (equals) for all parameters which are repeated in the inner function that is called. (I90490) - Add support for action chip (I07100, b/192585545)
Version 1.2.0-alpha01
January 12, 2022
androidx.compose.material:material-*:1.2.0-alpha01
is released. Version 1.2.0-alpha01 contains these commits.
Dependency Updates
- Now depends on Kotlin
1.6.10
.
External Contribution
ModalBottomSheetState
now has aisSkipHalfExpanded
flag. It can be either set through the constructor or updated later on by settingModalBottomSheetState
'sisSkipHalfExpanded
property totrue
. UpdatingisSkipHalfExpanded
's value causes a recomposition of the sheet. (I18b86, b/186669820)
Version 1.1
Version 1.1.1
February 23, 2022
androidx.compose.material:material-*:1.1.1
is released. Version 1.1.1 contains these commits.
Bug Fixes
- Fix
NullPointerException
atandroidx.compose.ui.platform.RenderNodeLayer.updateDisplayList
(aosp/1947059, b/206677462) - Fix crash caused by clipboard content while reading from clipboard on Android. (I06020, b/197769306)
- Fixed RTL in
LazyVerticalGrid
(aosp/1931080, b/207510535)
Version 1.1.0
February 9, 2022
androidx.compose.material:material-*:1.1.0
is released. Version 1.1.0 contains these commits.
Important changes since 1.0.0
- Stable support for the Android 12 Overscroll effect
- Improvements to touch target sizing
- Note that, with respect to Compose 1.0, Material components will expand their layout space to meet Material accessibility guidelines for touch target size. For instance, Button touch target will expand to a minimum size of 48x48dp, even if you set the Button's size to be smaller. This aligns Compose Material to the same behavior of Material Design Components, providing consistent behavior if you mix Views and Compose. This change also ensures that when you create your UI using Compose Material components, minimum requirements for touch target accessibility will be met.
- Stable Support for Navigation Rail
- Graduates a number of previously experimental APIs to stable
- Support for newer versions of Kotlin
Version 1.1.0-rc03
January 26, 2022
androidx.compose.material:material-*:1.1.0-rc03
is released. Version 1.1.0-rc03 contains these commits.
Behaviour Changes
Note that, with respect to Compose 1.0, Material components will expand their layout space to meet Material accessibility guidelines touch target size. For instance, Button touch target will expand to a minimum size of 48x48dp, even if you set the Button's size to be smaller. This aligns Compose Material to the same behavior of Material Design Components, providing consistent behavior if you mix Views and Compose. This change also ensures that when you create your UI using Compose Material components, minimum requirements for touch target accessibility will be met.
Bug Fixes
- Added some better debug information for the layout inspector when inspecting minimum touch target modifiers. (aosp/1955036)
Version 1.1.0-rc01
December 15, 2021
androidx.compose.material:material-*:1.1.0-rc01
is released. Version 1.1.0-rc01 contains these commits.
Bug Fixes
- Fix the corner radius that is applied for
Checkbox
es (I38b03, b/175198975, b/202309440)
Version 1.1.0-beta04
December 1, 2021
androidx.compose.material:material-*:1.1.0-beta04
is released. Version 1.1.0-beta04 contains these commits.
New Features
- Updated to be compatible with Kotlin
1.6.0
Version 1.1.0-beta03
November 17, 2021
androidx.compose.material:material-*:1.1.0-beta03
is released. Version 1.1.0-beta03 contains these commits.
Version 1.1.0-beta02
November 3, 2021
androidx.compose.material:material-*:1.1.0-beta02
is released. Version 1.1.0-beta02 contains these commits.
Bug Fixes
- Ripples and other indications will now only be delayed if they are inside a Modifier.scrollable() container, instead of always being delayed for a down event. (Ibefe0, b/203141462)
Version 1.1.0-beta01
October 27, 2021
androidx.compose.material:material-*:1.1.0-beta01
is released. Version 1.1.0-beta01 contains these commits.
New Features
- Ripples now support hover and focus states, so hovering / focusing a component such as Button will now show the correct state overlay.
Version 1.1.0-alpha06
October 13, 2021
androidx.compose.material:material-*:1.1.0-alpha06
is released. Version 1.1.0-alpha06 contains these commits.
API Changes
- A child-less overload for Layout was added, with improved efficiency (Ib0d9a)
- Implementation of
ExposedDropdownMenu
based onExposedDropdownMenuBox
withTextField
andDropdownMenu
inside (If60b2) dismissOnOutsideClick
was added toPopupProperties
, replacingdismissOnClickOutside
which was deprecated. The new property receives the click position and the anchor bounds, providing finer control over whether onDismissRequest should be invoked or not. For example, this can be useful to prevent anchor dismissal for touches on the anchor.updateAndroidWindowManagerFlags
was added toPopupProperties
, offering low-level control over the flags passed by the popup to the Android WindowManager. The parameter of the lambda will be the flags calculated from the PopupProperties values that result in WindowManager flags: e.g. focusable. The result of the lambda will be the final flags which will be passed to the Android WindowManager. By default, updateAndroidWindowManagerFlags will leave the flags calculated from parameters unchanged. This API should be used with caution, only in cases where the popup has very specific behavior requirements. (I6e9f9)
Version 1.1.0-alpha05
September 29, 2021
androidx.compose.material:material-*:1.1.0-alpha05
is released. Version 1.1.0-alpha05 contains these commits.
API Changes
- Adds minimum touch target sizing for Material components that do not have an accessible touch target. As this adds extra spacing around components to make sure they have a large enough touch target, this may change existing UIs that assume the size of these components is their visual size, and doesn't account for touch target size. You can use the experimental
LocalMinimumTouchTargetEnforcement
composition local to disable this behavior across a hierarchy, but this is intended only to be a temporary escape hatch while updating existing UIs to account for the new minimum size. (I9b966, b/149691127, b/171509422) - Added experimental TextFieldColorsWithIcons interface, extending TextFieldColors to provide InteractionSource to the leadingColor and trailingColor. This enables modifying the appearance of TextField according to the focus state. (I66923, b/198402662)
Version 1.1.0-alpha04
September 15, 2021
androidx.compose.material:material-*:1.1.0-alpha04
is released. Version 1.1.0-alpha04 contains these commits.
API Changes
- Deprecated
performGesture
andGestureScope
, which have been replaced byperformTouchInput
andTouchInjectionScope
. (Ia5f3f, b/190493367) - Added
touchBoundsInRoot
toSemanticsNode
that includes the minimum touch target size so that developers can ensure that touch targets meet accessibility minimums. (I2e14b, b/197751214)
Bug Fixes
- Allow clip to extend touch target bounds beyond the clip region for minimum touch target purposes. (I43e10, b/171509422)
- Updated
Divider
composable to respectDp.Hairline
for the thickness parameter to support drawing single pixel dividers regardless of display density. (I16ffb, b/196840810)
Version 1.1.0-alpha03
September 1, 2021
androidx.compose.material:material-*:1.1.0-alpha03
is released. Version 1.1.0-alpha03 contains these commits.
New Features
- Updated Compose
1.1.0-alpha03
to depend on Kotlin1.5.30
. (I74545)
API Changes
- Added test method to get the clipped bounds. (I6b28e)
- Added minimum touch target size to ViewConfiguration for use in semantics and pointer input to ensure accessibility. (Ie861c)
Version 1.1.0-alpha02
August 18, 2021
androidx.compose.material:material-*:1.1.0-alpha02
is released. Version 1.1.0-alpha02 contains these commits.
External Contribution
- Fix the behavior of SwipeableState in the case where the swipe offset is within a rounding error of an anchor. (I03d39, b/191993377)
Version 1.1.0-alpha01
August 4, 2021
androidx.compose.material:material-*:1.1.0-alpha01
is released. Version 1.1.0-alpha01 contains these commits.
API Changes
- Updated
DrawScope#drawImage
method that consumes source and destination rects to consume an optional FilterQuality parameter. This is useful for pixel art that is intended to be pixelated when scaled up for pixel based art. Updated BitmapPainter + Image composable to also consume an optional FilterQuality parameter (Ie4fb0, b/180311607) - Renamed BadgeBox to BadgedBox, changed parameters to accept Badge composable. Added Badge component that is the typical badge content for a BadgedBox. (I639c6)
- Added NavigationRail component, see the docs and samples for usage information (I8de77)
Bug Fixes
- Added a bottom-aligned NavigationRail sample and Catalog app demo. (I3cffc)
- Dialogs now follow the platform sizing behaviour. Set usePlatformDefaultWidth to false to override this behaviour. (Iffaed, b/192682388)
- Added navigation-rail demo to the catalog app. (I04960)
- Added badge demo to the catalog app. (If285d)
Version 1.0
Version 1.0.5
November 3, 2021
androidx.compose.material:material-*:1.0.5
is released. Version 1.0.5 contains these commits.
Bug Fixes
- Fixed a crash tracking derivedStateOf instances. (aosp/1792247)
Version 1.0.4
October 13, 2021
androidx.compose.material:material-*:1.0.4
is released. Version 1.0.4 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.31
Version 1.0.3
September 29, 2021
androidx.compose.material:material-*:1.0.3
is released. Version 1.0.3 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.30
Version 1.0.2
September 1, 2021
androidx.compose.material:material-*:1.0.2
is released. Version 1.0.2 contains these commits.
Updated to support the Compose 1.0.2
release. Compose 1.0.2
is still compatible with Kotlin 1.5.21
.
Version 1.0.1
August 4, 2021
androidx.compose.material:material-*:1.0.1
is released. Version 1.0.1 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.21
.
Version 1.0.0
July 28, 2021
androidx.compose.material:material-*:1.0.0
is released. Version 1.0.0 contains these commits.
Major features of 1.0.0
This is the first stable release of Compose. Please see the official Compose Release blog for more details!
Known Issues
If you are using Android Studio Bumblebee Canary 4 or AGP
7.1.0-alpha04
/7.1.0-alpha05
, you may hit the following crash:java.lang.AbstractMethodError: abstract method "void androidx.lifecycle.DefaultLifecycleObserver.onCreate(androidx.lifecycle.LifecycleOwner)"
To fix, temporarily increase your minSdkVersion to 24+ in your
build.gradle
file. This issue will be fixed in the next version of Android Studio Bumblebee and AGP7.1
. (b/194289155)
Version 1.0.0-rc02
July 14, 2021
androidx.compose.material:material-*:1.0.0-rc02
is released. Version 1.0.0-rc02 contains these commits.
Bug Fixes
- Dialogs now follow the platform sizing behaviour. Set
usePlatformDefaultWidth
to false to override this behaviour. (Iffaed, b/192682388)
Version 1.0.0-rc01
July 1, 2021
androidx.compose.material:material-*:1.0.0-rc01
is released. Version 1.0.0-rc01 contains these commits.
API Changes
- Added
BadgeBox
component, see the docs and samples for usage information (I5e284) useDefaultMaxWidth
inPopupProperties
was renamed tousePlatformDefaultWidth
. (I05710)- Dialogs are now able to use the entire screen width. (I83929, b/190810877)
- Added Experimental Range Slider implementation (I2f4b3)
Bug Fixes
- To align with Material Design specs OutlinedTextField with invalid input stopped using error color for label when label is being used as a placeholder. The latter is true when there is no input text in the text field and the text field is not in focus. With that change the meaning of the
error:Boolean
parameter inTextFieldColors.labelColor()
function also changed: it will now returnfalse
even when the input is invalid if the label is being used as a placeholder. (I45f78)
Version 1.0.0-beta09
June 16, 2021
androidx.compose.material:material-*:1.0.0-beta09
is released. Version 1.0.0-beta09 contains these commits.
API Changes
- Added Shape parameter to OutlinedTextField to be able to customize the shape of the border (I8f39e, b/181322957)
- TextOverflow is changed to an inline class. (I433af)
Bug Fixes
- Scrim in BottomDrawer, BackdropScaffold and ModalBottomSheetLayout will disappear then the Color.Unspecified is passed (I2d899, b/182063309)
Added Profile Rules
This release adds profile rules to the following compose modules (I14ed6):
- androidx.compose.animation
- androidx.compose.animation-core
- androidx.compose.foundation
- androidx.compose.foundation-layout
- androidx.compose.material
- androidx.compose.material-ripple
- androidx.compose.runtime
- androidx.compose.ui
- androidx.compose.ui.geometry
- androidx.compose.ui.graphics
- androidx.compose.ui.text
- androidx.compose.ui.text
- androidx.compose.ui.unit
- androidx.compose.ui.util
What are profile rules?
Profile rules for a library are specified in a text file
baseline-prof.txt
located in thesrc/main
or equivalent directory. The file specifies a rule per line, where a rule in this case is a pattern for matching to methods or classes in the library. The syntax for these rules is a superset of the human-readable ART profile format that is used when usingadb shell profman --dump-classes-and-methods ...
. These rules take one of two forms to target either methods or classes.A method rule will have the following pattern:
<FLAGS><CLASS_DESCRIPTOR>-><METHOD_SIGNATURE>
And a class rule will have the following pattern:
<CLASS_DESCRIPTOR>
Here
<FLAGS>
is one or more of the charactersH
,S
, andP
to indicate whether or not this method should be flagged as "Hot", "Startup", or "Post Startup".The
<CLASS_DESCRIPTOR>
is the descriptor for the class that the targeted method belongs to. For example, the classandroidx.compose.runtime.SlotTable
would have a descriptor ofLandroidx/compose/runtime/SlotTable;
.The
<METHOD_SIGNATURE>
is the signature of the method, and includes the name, parameter types, and return types of the method. For example, the methodfun isPlaced(): Boolean
onLayoutNode
has the signatureisPlaced()Z
.These patterns can have wildcards (
**
,*
, and?
) in order to have a single rule encompass multiple methods or classes.
What do the rules do?
A method that has the flag
H
indicates that this method is a "hot" method, and should be compiled ahead of time.A method that has the flag
S
indicates that it is a method which is called at startup, and should be compiled ahead of time to avoid the cost of compilation and interpreting the method at startup time.A method that has the flag
P
indicates that it is a method which is called after startup.A class that is present in this file indicates that it is used during startup and should be pre-allocated in the heap to avoid the cost of class loading.
How does this work?
- Libraries can define these rules which will be packaged in AAR artifacts. When an APK is then built which includes these artifacts, these rules are merged together and the merged rules are used to build a compact binary ART profile that is specific to the APK. ART can then leverage this profile when the APK is installed on devices in order to ahead-of-time compile a specific subset of the application to improve the performance of the application, especially the first run. Note that this will have no effect on debuggable applications.
Version 1.0.0-beta08
June 2, 2021
androidx.compose.material:material-*:1.0.0-beta08
is released. Version 1.0.0-beta08 contains these commits.
New Features
Behavior Breaking API Change
- BEHAVIOUR-BREAKING: Card now consumes clicks, making clicks added via
Card(Modifier.clickable)
to be a no-op. Please, use new experimental overload of a Card that accepts onClick. (Ia8744, b/183775620)- Added a new Card overload that handles clicks as well as other clickable functionality: indication, interactionSource, enabled/disabled. It wasn't possible to use a regular non-clickable Card with the
Modifier.clickable
because the Card will not clip the ripple indication in those cases.
- Added a new Card overload that handles clicks as well as other clickable functionality: indication, interactionSource, enabled/disabled. It wasn't possible to use a regular non-clickable Card with the
- BEHAVIOUR-BREAKING: Surface now consumes clicks, making clicks added via
Surface(Modifier.clickable)
to be a no-op. Please, use new experimental overload of Surface that accepts onClick. (I73e6c, b/183775620)- Added a new Surface overload that handles clicks as well as other clickable functionality: indication, interactionSource, enabled/disabled. It wasn't possible to use a regular non-clickable Surface with the
Modifier.clickable
because the Surface will not clip the ripple indication in those cases.
- Added a new Surface overload that handles clicks as well as other clickable functionality: indication, interactionSource, enabled/disabled. It wasn't possible to use a regular non-clickable Surface with the
API Changes
FabPosition
was converted to inline class from enum to support potential expansion in the future (I030fb)- Refactored enum usages to inline classes to avoid issues with exhaustive when statements when new enum values are added. (I2b5eb)
- Adds a tap timeout to clickable / toggleable to prevent showing a ripple during a scroll / drag (Ia2704, b/168524931)
- ContentDescription and Text semantics properties are no longer single values but lists. This enables to merge them as they are instead of concatenations. Also provided better testing APIs to utilize these changes (Ica6bf, b/184825850)
Modifier.focusModifier()
is deprecated and replaced byModifier.focusTarget()
(I6c860)- Replaced
FocusState
enum with aFocusState
interface (Iccc1a, b/187055290) - Removed
LocalRippleNativeRendering
now that the View-backed ripple implementation is stable (I7fab3, b/188569367)
Bug Fixes
Modifier.onGloballyPositioned()
was changed to report the coordinates of this modifier in the modifier chain, not the layout coordinates after applying all the modifiers. This means that now the ordering of modifiers is affecting what coordinates would be reported. (Ieb67d, b/177926591)- Added a README for the existing Compose Material catalog. (If9191)
Version 1.0.0-beta07
May 18, 2021
androidx.compose.material:material-*:1.0.0-beta07
is released. Version 1.0.0-beta07 contains these commits.
API Changes
- You no longer need to use extension methods for route support in Navigation Compose. (I22beb, b/172823546)
Version 1.0.0-beta06
May 5, 2021
androidx.compose.material:material-*:1.0.0-beta06
is released. Version 1.0.0-beta06 contains these commits.
API Changes
- Ripple has been migrated to use
RippleDrawable
internally on Android devices. This means that ripple animations will happen on the RenderThread, and so will be smooth even when the UI thread is under load, such as when navigating between screens. This does not change the API surface of ripple, but there may be behavior changes introduced as a result of this change. To aid the migration,LocalRippleNativeRendering
has been added - provide a value offalse
to this CompositionLocal to fall back to the previous ripple implementation inside the CompositionLocalProvider. This API is temporary and will be removed in the future, so if you run into issues that cause you to use this API, please file a bug. (I902f8, b/168777351, b/183019123) - Added CollectionInfo and CollectionItemInfo accessibility APIs that allows to mark collection and its items for accessibility services (Id54ef, b/180479017)
- Added accessibility API
error
that allows to mark a node that contains invalid input (I12997, b/180584804, b/182142737)
Bug Fixes
- Updated Compose Material catalog insets implementation from: https://github.com/google/accompanist/pull/365. (I25dc3)
- Row & Column children with weight(fill = false) are no longer making the parent fill the entire available main axis space. (Ied94d, b/186012444, b/184355105)
Version 1.0.0-beta05
April 21, 2021
androidx.compose.material:material-*:1.0.0-beta05
is released. Version 1.0.0-beta05 contains these commits.
Bug Fixes
- Added component tile images, theme picker, and more specific menu URLs to existing Compose Material catalog. (I9b58e)
Version 1.0.0-beta04
April 7, 2021
androidx.compose.material:material-*:1.0.0-beta04
is released. Version 1.0.0-beta04 contains these commits.
API Changes
- API CHANGE:
DrawerState
state is no longer extends experimental SwipeableState.- API CHANGE:
BottomDrawerState
is now marked as Experimental, to match already Experimental BottomDrawer component (I81114, b/181656094)
- API CHANGE:
- Rename
hideSoftwareKeyboard
andshowSoftwareKeyboard
onSoftwareKeyboardController
tohide()
andshow()
respectively.- Provide the full CompositionLocal interface for LocalSoftwareKeyboardController, allowing it to be set (especially useful in tests) (I579a6)
- LiveRegion accessibility API is added. If node is marked as a live region, the accessibility services will automatically notify the user about its changes (Idcf6f, b/172590946)
Bug Fixes
- Added implementation of Compose Material catalog to existing module. Currently missing: component tile images, theme picker (to be added in follow-up changes). (Ie7a94)
Version 1.0.0-beta03
March 24, 2021
androidx.compose.material:material-*:1.0.0-beta03
is released. Version 1.0.0-beta03 contains these commits.
API Changes
DefaultMonotonicFrameClock
is deprecated. CallingwithFrameNanos
orRecomposer.runRecomposeAndApplyChanges
with noMonotonicFrameClock
will now throwIllegalStateException
. (I4eb0d)- Added a new API
LeadingIconTab
to support displaying an icon and inline text in a tab. (I23267)
External Contribution
- [by Jossi Wolf]
BottomDrawer
now wraps the content of the drawer slot.BottomDrawer
doesn't throw anIllegalStateException
when the parent has infinite height. The bottom drawer will now open to an expanded state if it is smaller than 50% of its parent. Docs aroundBottomDrawerState
andModalBottomSheetLayoutState
have been updated.BottomDrawerState#isOpen
returns true now if it is in either open or expanded state. (I87241)
Version 1.0.0-beta02
March 10, 2021
androidx.compose.material:material-*:1.0.0-beta02
is released. Version 1.0.0-beta02 contains these commits.
API Changes
- Added new
LocalSoftwareKeyboardController
composition local API to replace previousSoftwareKeyboardController
interface on TextField. (I5951e, b/168778053)
Bug Fixes
- Enforce restrictions on public usage of experimental APIs (I6aa29, b/174531520)
- Changed the default horizontal alignment for TopAppBar and BottomAppBar to Start, consistent with Row (Ib2dc7)
- Added a new module and placeholder UI for a Compose Material catalog, currently nested in existing integration test demos. (Idfcb3)
androidx.compose.ui:ui
no longer depends on AppCompat or Fragment. If you are using a ComposeView in your application, and you are using Fragment and/or AppCompat, make sure that you are using AppCompat 1.3+ / Fragment 1.3+ - these versions are needed to correctly set lifecycle and saved state owners required for ComposeView. (I1d6fa, b/161814404)
Version 1.0.0-beta01
February 24, 2021
androidx.compose.material:material-*:1.0.0-beta01
is released. Version 1.0.0-beta01 contains these commits.
This is the first release of Compose 1.0.0 Beta.
API Changes
- Size modifiers were renamed. Modifier.width/height/size were renamed to requiredWidth/requiredHeight/requiredSize. Modifier.preferredWidth/preferredHeight/preferredSize were renamed to width/height/size. (I5b414)
- imageResource and vectorResource are now extension functions on ImageBitmap and ImageVector companions respectively. load{Image,Vector,Font}Resource functions have been deleted. (I89130)
- Modifiers for sizing to intrinsics are no longer experimental. (I15744)
- Removed dp assertions (I798d2)
- Removed SoftwareKeyboardController callback from all text fields to be replaced by a new API shortly. (Iae869, b/168778053)
- Switch, Checkbox and RadioButton action lambdas are now nullable. Checkbox-in-clickable-row samples updated to use this feature. (If601b, b/171819073)
InteractionState
has been replaced with[Mutable]InteractionSource
- Interfaces are responsible for emitting / collecting Interaction events.
- Instead of passing
interactionState = remember { InteractionState() }
to components such asButton
andModifier.clickable()
, useinteractionSource = remember { MutableInteractionSource() }
. - Instead of:
Interaction.Pressed in interactionState
you should instead use the extension functions on InteractionSource, such as InteractionSource.collectIsPressedAsState(). - For complex use cases you can use InteractionSource.interactions to observe the stream of Interactions. See the InteractionSource documentation and samples for more information.
- (I85965, b/152525426, b/171913923, b/171710801, b/174852378)
- Add AccessibilityMananger interface and LocalAccessibilityMananger in CompositionLocals (I53520)
- Removed deprecated LayoutCoordinates methods, use function instead of the property for positionInParent and boundsInParent (I580ed, b/169874631, b/175142755)
- Slider now supports enabled/disabled state (I6d56b, b/179793072)
- Created new TextInputSession for input sessions from low level text components such as CoreTextField. (I8817f, b/177662148)
- AnimationEndReason.Interrupted is removed. CancellationException will be throws if animation is interrupted. (I2cbbc, b/179695417)
- Removed
@ExperimentalRippleApi
and changedRippleAlpha
to be a class with properties instead of an interface. (I6df7c) - Added TextFieldColors interface to represent different colors used in TextField and OutlinedTextField in different states. For defaut implementation see TextFieldDefaults.textFieldColors and TextFieldDefaults.outlinedTextFieldColors.
- Renamed isErrorValue parameter inside TextField and OutlinedTextField into isError. (I831f9, b/171305338, b/168004067)
- Add selectionGroup modifier that allows to mark collection of Tabs or RadioButtons for accessibility purposes (Ie5c29)
Add LazyListState.animateScrollToItem
This method smooth scrolls to a specific item in the list. (I4bfd7)
ScrollableState.smoothScrollBy()
was renamed toanimateScrollBy()
LazyListState.snapToItemIndex()
was renamed toscrollToItem()
ScrollState.smoothScrollTo()
was renamed toanimateScrollTo()
(I35ded)Any composables marked with
@ReadOnlyComposable
are now compile-time validated to ensure that they only make calls to other@ReadOnlyComposables
(I58961)TargetAnimation API has been removed. (If47d1, b/177457083)
Scroll position in Modifier.verticalScroll()/horizontalScroll() is represented with Ints now (I81298)
smoothScrollBy and scrollBy methods' packages changed to
androidx.compose.foundation.gestures.*
(I3f7c1, b/175294473)FlingConfig has been renamed to FlingBehavior now allows for customization of suspend animation rather than predefined Decays. (I02b86, b/175294473)
Size modifiers were renamed. Modifier.width/height/size were renamed to requiredWidth/requiredHeight/requiredSize. Modifier.preferredWidth/preferredHeight/preferredSize were renamed to width/height/size. (I5b414)
defaultMinSizeConstraints was renamed to defaultMinSize. (I4eaae)
Orientation has been moved to foundation package. VelocirtTracker moved from ui.gesture to ui.input.pointer. (Iff4a8, b/175294473)
drawerState.open() and drawerState.close() are now suspending functions. Use rememberCoroutineScope() to get the scope of the composition to call them (I16f60, b/175294473)
Providers has been renamed to CompositionLocalProvider
- The Composition constructor no longer accepts a key parameter, and has been deprecated.
- currentCompositeKeyHash has been turned into a composable top level property instead of a composable top level function.
- CompositionData and CompositionGroup have been moved to the androidx.compose.runtime.tooling namespace
- ComposableLambda has been made an interface instead of a concrete class, and no longer has type parameters.
- ComposableLambdaN has been made an interface instead of a concrete class, and no longer has type parameters.
- The snapshotFlow function has been moved to the androidx.compose.runtime namespace
- the merge method of SnapshotMutationPolicy is no longer experimental
- The
@TestOnly
top level clearRoots function has been removed. It is no longer necessary. - keySourceInfoOf and resetSourceInfo functions have been removed. They are no longer necessary.
- Composer.collectKeySourceInformation has been removed. It is no longer necessary.
- isJoinedKey, joinedKeyLeft, and joinedKeyRight methods have been removed. They are no longer necessary.
- Various top level APIs have been moved and reorganized into different files. Due to Kotlin’s file class semantics, this will break binary compatibility but not source compatibility, so should not be an issue for most users.
- (I99b7d, b/177245490)
Modifier.scrollable has been reworked. Now it uses Scrollable interface instead of ScrollableController class (I4f5a5, b/174485541, b/175294473)
Modifier.draggable now accepts DraggableState instead of a simple lambda. you can create state via
rememberDraggableState { delta -> }
to get the same behaviour as before (Ica70f, b/175294473)ZoomableController.smoothScaleBy and ZoomableController.stopAnimation are now suspend functions. (I7f970, b/177457083)
Deleted some previously deprecated APIs (Ice5da, b/178633932)
Made the following Material API changes:
- Added contentPadding parameter to Top/BottomAppBar to allow customizing the default padding.
- Reordered parameters in BackdropScaffold to follow API guidelines for required parameters being before optional parameters.
- Moved
icon
parameter in BottomNavigationItem to be afterselected
andonClick
. - Renamed
alwaysShowLabels
parameter in BottomNavigationItem toalwaysShowLabel
. - Renamed
bodyContent
parameters in a few components to justcontent
. - Reordered parameters in
ButtonDefaults.buttonColors()
. Please note that because the type of the parameters have not changed, this will not cause an error in your code - please ensure you are either using named parameters or update the ordering manually, otherwise your code will not work the same as previously. - Added
secondaryVariant
parameter todarkColors()
. This color is typically the same assecondary
in dark theme, but adding for consistency and further customization. - Removed ElevationDefaults and animateElevation() from the public API surface since they were not commonly used / useful.
- Renamed
onValueChangeEnd
inSlider
toonValueChangeFinished
and made it nullable. - Renamed
text
parameter inSnackbar
tocontent
for consistency. - Added
contentPadding
parameter toDropdownMenuItem
to allow customizing the default padding and madecontent
be an extension onRowScope
. - Renamed
ModalDrawerLayout
toModalDrawer
. - Renamed
BottomDrawerLayout
toBottomDrawer
. - (I1cc66)
BasicTextField now accepts Brush instead of Color for better customization (I83a36)
imageResource and vectorResource are now extension functions on ImageBitmap and ImageVector companions respectively. load{Image,Vector,Font}Resource functions have been deleted. (I89130)
Changed Indication#createIndication() to Indication#rememberUpdatedIndication(InteractionState) and removes InteractionState parameter from IndicationInstance#drawIndication(). IndicationInstance should only be responsible for drawing visual effects, and not launching animations / writing state in response to InteractionState changes. These animations and state writes should happen within
rememberUpdatedIndication()
instead. Theindication
parameter inModifier.indication
was also changed to be a required parameter. (Ic1764, b/152525426)
Bug Fixes
- Added new LocalSoftwareKeyboardController composition local API to replace previous SoftwareKeyboardController interface on TextField. (I658b6, b/168778053)
Version 1.0.0-alpha12
February 10, 2021
androidx.compose.material:material-*:1.0.0-alpha12
is released. Version 1.0.0-alpha12 contains these commits.
API Changes
- Modifier.pointerInput now requires remember keys to indicate when the pointer input detection coroutine should restart for new dependencies. (I849cd)
- BottomDrawerLayout and ListItem have been marked as @ExperimentalMaterialApi (Id766e)
- PaddingValues.Absolute was added and can be used in APIs accepting PaddingValues. (Ia5f30)
- onImeActionPerformed is deprecated. use KeyboardActions instead (If0bbd, b/179071523)
- In order to better match naming conventions with ImageBitmap and ImageVector, ImagePainter has been renamed to BitmapPainter to parallel VectorPainter. (Iba381, b/174565889)
- Animatable.snapTo and Animatable.stop are now suspend functions (If4288)
- ComponentActivity.setContent has moved to androidx.activity.compose.setContent in the androidx.activity:activity-compose module. (Icf416)
- Destructuring and copy() methods have been removed from several classes where they were rarely used. (I26702, b/178659281)
- Make halfExpand() and expand() in ModalBottomSheetState internal (Ic914e)
- Changed Indication#createInstance to be @Composable, and changed LocalIndication to contain an Indication, not () -> Indication. (I5eeea, b/157150564)
- Moved AlertDialog and DropdownMenu to be Android only for now. Added PopupProperties parameter to DropdownMenu for further configuration of the underlying Popup. (I9c443)
- loadFontResource is deprecated. Use fontResource instead. imageResource, loadImageResource, vectorResource, and loadVectorResource are deprecated. Use painterResource instead. (I6b809)
- Removed
toggle
andtoggleModifier
parameter from DropdownMenu, and renameddropdownModifier
,dropdownOffset
anddropdownContent
tomodifier
,offset
andcontent
respectively. DropdownMenu now behaves consistently toPopup
, where the parent layout is used for the position of the menu. In most cases you can movetoggle
to be a sibling ofDropdownMenu
and wrap both in aBox
. See the updated sample in the documentation for more information on usage of this API. (I884fb) - toIntPx() was renamed to roundToPx(). (I9b7e4, b/173502290)
- IntBounds was renamed to IntRect and the API was improved. (I1f6ff)
- Added expand and collapse semantics actions. Added expand and halfExpand in ModalBottomSheetState (Ib5064)
- Modifier.dragGestureFilter has been deprecated. Use
Modifier.pointerInput { detectDragGestures (...)}
instead. Alternatively, use Modifier.draggable for one axis drags (I0ba93, b/175294473) - Renamed Ambients to match the Ambient -> CompositionLocal rename. Ambients used to be named AmbientFoo, now CompositionLocals are named LocalFoo. (I2d55d)
- Selection was moved to foundation. (I7892b)
- Similarly to how we previously removed
state { 0 }
composable and now promote usage likeremember { mutableStateOf(0) }
we are going to removesavedInstanceState { 0 }
composable. You should userememberSaveable { mutableStateOf(0) }
instead and it will save and restore automatically if the type used inside the MutableState can be stored in the Bundle. If previously you were passing a custom saver object now you need to use a new overload of rememberSaveable which hasstateSaver
parameter. The usage will look like this:val holder = rememberSaveable(stateSaver = HolderSaver) { mutableStateOf(Holder(0)) }
(Ib4c26, b/177338004) - Added ProgressBarRangeInfo.Indeterminate to mark indeterminate progress bars for accessibility (I6fe05)
@ComposableContract has been deprecated in favor of three more specific annotations.
@ComposableContract(restartable = false)
has become@NonRestartableComposable
@ComposableContract(readonly = true)
has become@ReadOnlyComposable
@ComposableContract(preventCapture = true)
has become@DisallowComposableCalls
@ComposableContract(tracked = true)
has been removed.- (I60a9d)
emptyContent()
and(@Composable () -> Unit).orEmpty()
utilities have been deprecated as they no longer have any positive performance impact or value (I0484d)rememberSavedInstanceState() was renamed to rememberSaveable() and moved to androidx.compose.runtime.saveable package. (I1366e, b/177338004)
Saver, listSaver(), mapSaver(), autoSaver was moved from androidx.compose.runtime.savedinstancestate to androidx.compose.runtime.saveable (I77fe6)
Parameters on RounderCornerShape, CutCornerShape and CornerBasedShape were renamed from left/right to start/end in order to support the shape's auto mirroring in the rtl direction. AbsoluteRounderCornerShape and AbsoluteCutCornerShape were introduced for the cases when auto-mirroring is not desired. (I61040, b/152756983)
Changed Tab's
text
andicon
parameters, and BottomNavigationItem'slabel
parameter to be nullable, to better convey the behavior of the component when these parameters are / are not provided, since it affects the size and layout of the component. If you are currently passingemptyContent()
to represent no text / icon / label, you should usenull
instead. (I57ed4)Renamed contentColorFor color parameter to backgroundColor (I5bb67)
Deprecated TabDefaults and replaced it with TabRowDefaults. (I0f189)
Introduced ColorMatrix API used to modify rgb values of source content Refactored ColorFilter API to be an interface and match the implementation of PathEffect. (Ica1e8)
AnimatedValue/Float is now deprecated. Please use Animatable instead. (I71345, b/177457083)
Add SemanticsProperties.PaneTitle API. (I20d5a)
Added enabled parameters to Tab and BottomNavigationItem, to prevent them from being clickable. Changed BottomNavigationItem to be RowScope.BottomNavigationItem to better express its layout requirements in its API. (Id683d)
tapGestureFilter, doubleTapGestureFilter, longPressGestureFilter and pressIndicaitonGestureFilter have been deprecated. Use Modifier.clickable or Modifier.pointerInput with detectTapGestures function instead. (I6baf9, b/175294473)
Add layoutDirection param to Shape's createOutline. This allows to create layout direction aware shapes. (I57c20, b/152756983)
Removed
Recomposer.current()
. [Abstract]ComposeView now default to lazily created, window-scoped Recomposers driven by the ViewTreeLifecycleOwner for the window. Recomposition and withFrameNanos-based animation ticks are paused while the host Lifecycle is stopped. (I38e11)
Bug Fixes
- Icon will now scale up to fit its size, respecting size modifiers applied to it. For example
Icon(.., modifier = Modifier.size(50.dp)
will now draw in a 50x50dp space. (Ib2ba9, b/178796190)
Version 1.0.0-alpha11
January 28, 2021
androidx.compose.material:material-*:1.0.0-alpha11
is released. Version 1.0.0-alpha11 contains these commits.
API Changes
- Promotes some Material APIs to no longer be
@Experimental
(I5d20e) - Content description parameter has been added to the Image and Icon. It is used to provide description to the accessibility services (I2ac4c)
- Changes Material stateful parameter interfaces to have @Composable functions that return
State<T>
. AddsAnimatable.asState()
to make it easier to convert an Animatable to a State. Also changes animateElevation to be a suspend extension on Animatable. (If613c) - Snackbar, SnackbarHost, SnackbarHostState are not
@ExperimentalMaterialAPI
anymore (Id1fb5) - Changes Typography, Shapes, and TabPosition to no longer be data classes. Adds copy function for Typography and Shapes to replace the generated ones. (I40037)
- Deleted some previously deprecated Material APIs (Ifaa25)
Bug Fixes
- onCommit, onDispose, and onActive have been deprecated in favor of SideEffect and DisposableEffect APIs (If760e)
- TransitionDefinition-based Transition has been deprecated (I0ac57)
- Initial State in updateTransition is now supported (Ifd51d)
- WithConstraints was reworked as BoxWithConstraints and moved to foundation.layout. (I9420b, b/173387208)
Deprecate non-suspend scrollBy, remove non-suspend scrollTo
We now recommend using suspend functions to control scrolling and wait for the scroll to finish. We are deprecating and/or removing the non-suspend versions of these functions as part of this transition. (Ie9ced)
Deprecate non-suspend smoothScrollBy We now recommend using suspend functions to control scrolling and wait for the scroll to finish. We are deprecating the non-suspend versions of these functions as part of this transition. (I12880)
Introduced
ComposeContentTestRule
, which extendsComposeTestRule
and definessetContent
, which has been removed fromComposeTestRule
. Added a factory methodcreateEmptyComposeRule()
that returns aComposeTestRule
and does not launch an Activity for you. Use this when you want to launch your Activity during your test, e.g. usingActivityScenario.launch
(I9d782, b/174472899)The ripple used in Button and FloatingActionButton can no longer be customized by providing a new Indication through AmbientIndication - this was never intended to be a way to customize these components and this now makes these components consistent with other Material components. To customize ripples across an application, see RippleTheme. (I546c5)
animateAsState is now animateFooAsState, where Foo is the type of the variable being animated. e.g. Float, Dp, Offset, etc (Ie7e25)
BasicTextField received a new parameter called
decorationBox
. It allows to add the decorations like icons, placeholder, label and similar to the text field and increase the hit target area of it. (I16996)Fix for a bug which made it not possible to set the width of the material text field be less than 280.dp (I78373)
canDrag parameter has been removed from the Modifier.draggable (Ic4bec, b/175294473)
Remove displaySize as it should be avoided. Typically it is better to use size of onRoot() or window size at least. (I62db4)
Surface can now have multiple layout children. (I66a92, b/144488459)
invalidate and compositionReference() are now deprecated in favor of currentRecomposeScope and rememberCompositionReference respectively. (I583a8)
Changes PopupPositionProvider to use window-relative coordinates, not global coordinates. Renames parentGlobalBounds to anchorBounds, and changes windowGlobalBounds to be
windowSize: IntSize
(I2994a)Duration and Uptime will be replace with Long milliseconds, and this step removes the dependency of pointer input on those classes. (Ia33b2, b/175142755, b/177420019)
AnimatedFloat.fling that accepts FlingConfig has been removed. Please use suspend Animatable.animateDecay instead. (I4659b, b/177457083)
clickable, toggleable and selectable can be created outside of composition now (I0a130, b/172938345, b/175294473)
Easing has been changed to a functional interface (Ib14e5)
ScrollableColumn/Row were deprecated. Using ScrollableColumn is less efficient comparing to LazyColumn when you have a large scrolling content because with LazyColumn we can only compose/measure/draw visible elements. To prevent users from going inefficient way we decided to deprecate ScrollableColumn and ScrollableRow and promote usages of LazyColumn and LazyRow instead. Users can still decide they don't need the lazy behaviour and use the modifiers directly like this: Column(Modifier.verticalScroll(rememberScrollState())) (Ib976b, b/170468083)
New
items(count: Int)
factory method for scope of LazyColumn/LazyRow/LazyVerticalGrid.items(items: List)
anditemsIndexed(items: List)
are now extension functions so you have to manually import them when used. New extension overloads for Arrays:items(items: Array)
anditemsIndexed(Array)
(I803fc, b/175562574)Removed experimental monotonicFrameAnimationClockOf methods (Ib753f, b/170708374)
Deprecated global coordinates methods and made new window-based coordinates methods. (Iee284)
Added Modifier.toolingGraphicsLayer which adds a graphics layer modifier when inspection is turned on. (I315df)
FocusRequester.createRefs is now marked as experimental as it might change. (I2d898, b/177000821)
SemanticsPropertyReceiver.hidden was renamed to invisibleToUser and marked @ExperimentalComposeUiApi. AccessibilityRangeInfo was renamed to ProgressBarRangeInfo. stateDescriptionRange was renamed to progressBarRangeInfo. AccessibilityScrollState was renamed to ScrollAxisRange. horizontalAccessibilityScrollState was renamed to horizontalScrollAxisRange. verticalAccessibilityScrollState was renamed to verticalScrollAxisRange. (Id3148)
Leverage TestCoroutineDispatcher in testing (I532b6)
Updated vector graphics API to support parsing of tinting applied to root of vector graphics. (Id9d53, b/177210509)
Version 1.0.0-alpha10
January 13, 2021
androidx.compose.material:material-*:1.0.0-alpha10
is released. Version 1.0.0-alpha10 contains these commits.
API Changes
- Modified Velocity to have component parts and mathematical operations. (Ib0447)
- Renamed
@ExperimentalTesting
to@ExperimentalTestApi
to be consistent with similar experimental api annotations (Ia4502, b/171464963) - Renamed Position to DpOffset and removed getDistance() (Ib2dfd)
- Ranamed Color.useOrElse() to Color.takeOrElse() (Ifdcf5)
- Add Toggle to foundation Strings.kt (I4a5b7, b/172366489)
- FlowRow and FlowColumn were deprecated. Please use a custom layout instead. (I09027)
- Modifier.focus() and Modifier.focusRequester() are deprecated. Use Modifier.focusModifier() and Modifier.focusReference() instead. (I75a48, b/175160751, b/175160532, b/175077829)
- Moved nativeClass to ui module and made it internal. Updated usages of nativeClass in equals implementations to use 'is MyClass' instead. (I4f734)
Bug Fixes
- Added support for disabled and read-only text fields (I35279, b/171040474, b/166478534)
animate()
is now replaced withanimateAsState()
, which returns aState<T>
instead ofT
. This allows better performance, as the invalidation scope can be narrowed down to where the State value is read. (Ib179e)- Add Semantics role API and add Role as a parameter to clickable, selectable and toggleable SemanticsModifier. Changed Modifier.progressSemantics so that Slider can also use it. (I216cd)
Version 1.0.0-alpha09
December 16, 2020
androidx.compose.material:material-*:1.0.0-alpha09
is released. Version 1.0.0-alpha09 contains these commits.
API Changes
- added API to manually trigger settle animation and drag in Modifier.swipeable (Iaa17a, b/162408885)
- Renamed *Constants objects such as ButtonConstants to end with Defaults instead, such as ButtonDefaults. Also removes unnecessary
default
prefixes from properties in these new objects. (Ibb915, b/159982740) Compose supports property getters that can make composable invocations. Support for this is not going away, but the syntax for declaring a property getter as being @Composable is changing.
The now-deprecated syntax for doing this was by annotating the property itself:
@Composable val someProperty: Int get() = ...
The now-correct syntax for doing this is by annotating the getter of the property:
val someProperty: Int @Composable get() = ...
Both syntaxes will work for some time, but the former deprecated syntax will eventually become a compile error. (Id9197)
Added
androidx.compose.material:material-ripple
library containing ripple APIs to allow building interactive components without needing the rest of the Material library. rememberRippleIndication has been deprecated and replaced with rememberRipple. (Ibdf11)
Bug Fixes
- Lambdas in offset modifiers now return IntOffset rather than Float. (Ic9ee5, b/174137212, b/174146755)
Refactored ShaderBrush to lazily create a shader instance when sizing information of the drawing environment is available. This is useful to define gradients that occupy the full drawing bounds of a composable at composition time, without having to implement custom DrawModifier implementations.
Deprecated gradient function constructor APIs in favor of factory methods on a Gradient object. (I511fc, b/173066799)
Modifier.focusObserver is deprecated. Use Modifier.onFocusChanged or Modifier.onFocusEvent instead (I30f17, b/168511863, b/168511484)
Deprecate LazyColumnFor, LazyRowFor, LazyColumnForIndexed and LazyRowForIndexed. Use LazyColumn and LazyRow instead (I5b48c)
Moved Dp.VectorConverter, Position.VectorConverter, etc to animation-core, and deprecated the old VectorConveters (If0c4b)
Autofill API is now experimental API and requires opt-in (I0a1ec)
Adding destructuring declarations to create FocusRequester instances (I35d84, b/174817008)
accessibilityLabel has been renamed to contentDescription. accessibilityValue has been renamed to stateDescription. (I250f2)
New infiniteRepeatable function for creating an InfiniteRepeatableSpec (I668e5)
The positioning behaviour of DropdownMenus was slightly changed according to the Material spec. (I34c72, b/168594123)
InteractionState support for TextFields has been added. (I61d91)
Added Modifier.clearAndSetSemantics to clear descendants' semantics and set new ones. (I277ca)
Moved ContentDrawScope to ui-graphics module to be with DrawScope. (Iee043, b/173832789)
Version 1.0.0-alpha08
December 2, 2020
androidx.compose.material:material:1.0.0-alpha08
, androidx.compose.material:material-icons-core:1.0.0-alpha08
, and androidx.compose.material:material-icons-extended:1.0.0-alpha08
are released. Version 1.0.0-alpha08 contains these commits.
API Changes
- MaterialTheme now sets the correct colors for selection handles and selection background. Non-Material apps can manually use AmbientTextSelectionColors to customize the colors used for selection. (I1e6f4, b/139320372, b/139320907)
- Added lint check for composable lambda parameter naming and position, to check for consistency with Compose guidelines.
Also migrated some APIs using
children
as the name for their trailing lambda tocontent
, according to the lint check and guidance. (Iec48e) - Renamed VectorAsset to ImageVector Moved and renamed VectorAsset to Builder to be an inner class of ImageVector as per API council guidelines. Added typealias of VectorAssetBuilder to link to ImageVector.Builder for compat. (Icfdc8)
- Renamed ImageAsset and related methods to ImageBitmap. (Ia2d99)
- Moved foundation semantics properties to ui (I6f05c)
fun RippleIndication()
has been deprecated and replaced withrememberRippleIndication()
for consistency with other APIs. (Id8e2c)- Added a singeLine parameter into BasicTextField, TextField and OutlinedTextField. Set this parameter to true to make the text field a single horizontally scrollable line. (I57004, b/168187755)
Bug Fixes
- Add semantics action Dismiss (I2b706)
- Moved DrawModifier APIs from the androidx.compose.ui package to the androidx.compose.ui.draw package. Created DrawModifierDeprecated.kt file to include typealiases/helper methods to assist with the migration from the deprecated to the current APIs. (Id6044, b/173834241)
- Renamed Modifier.drawLayer to Modifier.graphicsLayer Also updated related classes to GraphicsLayer as per API feedback. (I0bd29, b/173834241)
<T>
was removed from SubcomposeLayout declaration. You can use it without specifying a type now. (Ib60c8)- Added Modifier.scale/rotate
APIs as conveniences for drawLayer.
- Renamed
Modifier.drawOpacity
toModifier.alpha
- Renamed
Modifier.drawShadow
toModifier.shadow
(I264ca, b/173208140)
- Renamed
- The alignment parameter of Box was renamed to contentAlignment. (I2c957)
- offsetPx modifiers were renamed to offset. They are now taking lambda parameters instead of State. (Ic3021, b/173594846)
- Introduced SweepGradientShader and SweepGradientBrush APIs. (Ia22c1)
- Added lint check for Modifier parameters in Composable functions. This lint check checks the naming, return type, default value, and order of the parameter for consistency with Compose guidelines. (If493b)
- Updated TextFieldValue API
- made TextFieldValue.composition readonly
- removed exception thrown for invalid selection range (I4a675, b/172239032)
- Added a new
Modifier.drawLayer()
overload. It takes a lambda block on a new GraphicsLayerScope where you define the layer parameters in a way which allows to skip recomposition and relayout when the state change happens. DrawLayerModifier is now internal in preparation to migrating its logic intoplaceable.placeWithLayer()
method of LayoutModifier (I15e9f, b/173030831) - Deprecated Ambients named with
Ambient
as their suffix, and replaced them with new properties prefixed with Ambient, following other Ambients and Compose API guidelines. (I33440) - Added lint check to check that Modifier factories use
androidx.compose.ui.composed {}
internally, instead of being marked as@Composable
. (I3c4bc) - Semantics argument mergeAllDescendants was renamed to mergeDescendants. (Ib6250)
- Time control in tests (TestAnimationClock and its usages) is now experimental (I6ef86, b/171378521)
- Remove old ui-test module and its stubs (I3a7cb)
- TextUnit.Inherit is renamed to TextUnit.Unspecified for consistency with other units. (Ifce19)
- The Alignment interface was updated and made functional. (I46a07, b/172311734)
- id was renamed to layoutId for LayoutIdParentData. Measurable.id was renamed to Measurable.layoutId. (Iadbcb, b/172449643)
Version 1.0.0-alpha07
November 11, 2020
androidx.compose.material:material:1.0.0-alpha07
, androidx.compose.material:material-icons-core:1.0.0-alpha07
, and androidx.compose.material:material-icons-extended:1.0.0-alpha07
are released. Version 1.0.0-alpha07 contains these commits.
API Changes
- Emphasis has been deprecated and replaced with AmbientContentAlpha. AmbientContentAlpha is a simpler abstraction that represents the preferred content alpha for part of the hierarchy, similar to how AmbientContentColor represents the preferred content color. Text and Icon now consume the current value from AmbientContentAlpha by default, and you can manually do:
color.copy(alpha = AmbientContentAlpha.current)
to have the same effect in your components. Instead of using ProvideEmphasis, you can just directly provide a value through AmbientContentAlpha, and use the new default levels in ContentAlpha to replace the old EmphasisLevels. (Idf03e, b/159017896) - Adds androidx.compose.material.AmbientContentColor to replace androidx.compose.foundation.AmbientContentColor (I84f7b, b/172067770)
- Adds androidx.compose.material.Text to replace androidx.compose.foundation.Text as a high level, themeable Text component. For a basic text component that does not consume color / text style from the theme, use BasicText. (Ie6ae0)
- Added maxLines to TextFields (Ib2a5b)
- Update TextFields to accept KeyboardOptions (Ida7f3)
- Surface now uses the absolute (total) elevation when calculating elevation overlays, so a Surface nested in another Surface will use the combined elevation to draw the overlay. (I7bd2b, b/171031040)
Bug Fixes
captureToBitmap
moved tocaptureToImage
. (I86385)- The foundation AmbientTextStyle, ProvideTextStyle, and AmbientContentColor have been deprecated. Instead use the new versions available in the Material library. For non-Material applications, you should instead create your own design system specific theming ambients that can be consumed in your own components. (I74acc, b/172067770)
- foundation.Text has been deprecated and replaced with material.Text. For a basic, unopinionated text API that does not consume values from a theme, see androidx.compose.foundation.BasicText. (If64cb)
- Rename KeyboardOptions as ImeOptions (I82f36)
- Moved KeyboardType and ImeAction into KeyboardOptions (I910ce)
- BaseTextField has been deprecated. Use BasicTextField instead. (I896eb)
- ExperimentalSubcomposeLayoutApi annotation was removed. SubcomposeLayout can now be used without adding @OptIn (I708ad)
- FirstBaseline and LastBaseline were moved to androidx.compose.ui.layout package (Ied2e7)
- Updated Icon API to take in Color.Unspecified as a possible tint color which will draw the provided asset or painter without a ColorFilter. Previously attempts to ignore tinting with Color.Unspecified would tint with a transparent color ending up with nothing rendered at all. (I049e2, b/171624632)
- relativePaddingFrom was renamed to paddingFrom. The paddingFromBaseline modifier was added, as convenience for specifying distances from layout bounds to text baselines. (I0440a, b/170633813)
- LaunchedTask was renamed to LaunchedEffect for consistency with the SideEffect and DisposableEffect APIs. LaunchedEffect with no subject params is not permitted in order to encourage best practices. (Ifd3d4)
- MeasureResult was moved out of MeasureScope. (Ibf96d, b/171184002)
- Several layout related symbols were moved from androidx.compose.ui to androidx.compose.layout.ui. (I0fa98, b/170475424)
Version 1.0.0-alpha06
October 28, 2020
androidx.compose.material:material:1.0.0-alpha06
, androidx.compose.material:material-icons-core:1.0.0-alpha06
, and androidx.compose.material:material-icons-extended:1.0.0-alpha06
are released. Version 1.0.0-alpha06 contains these commits.
API Changes
- androidx.compose.foundation.Icon has been moved to androidx.compose.material.Icon. You can also use the Image component / Modifier.paint() with a Painter if you do not want to use the Material library. (I9f622)
- Adds FloatingActionButtonElevation to represent elevation used by FABs in different states. See FloatingActionButtonConstants.defaultElevation() for the default implementation (I2d4f5)
- Adds SwitchColors interface to represent colors used by a Switch in different states. See SwitchConstants.defaultColors to customize these colors. (I93805)
- Adds ButtonElevation and ButtonColors interfaces to represent elevation and colors used by buttons in different states. See the default functions in ButtonConstants to customize these parameters. (Ic5b7b)
- Adds RadioButtonColors interface to represent colors used by a RadioButton in different states. See RadioButtonConstants.defaultColors() to customize the colors used in different states. (I74130)
- Adds CheckboxColors interface to represent colors used by a checkbox in different states. See CheckboxConstants.defaultColors() to customize the colors used in different states. (I7dbdb)
Bug Fixes
- Material components do not set the elevation as zIndex anymore. Which means that within the same parent the child with larger shadow size will not be drawn on top of the child with the smaller one automatically. If you still need such behavior please set Modifier.zIndex() manually where needed (I70417, b/170623932)
- Deprecate VectorPainter in favor of rememberVectorPainter to better indicate that the composable API internally leverages 'remember' to persist data across compositions. (Ifda43)
- Enable transitions in ComposeTestRule; remove option to enable the blinking cursor from ComposeTestRule. (If0de3)
- Added single line keyboard option to CoreTextField (I72e6d)
- Renamed Radius API to CornerRadius to better express how it is used throughout Compose. Updated documentation to indicate that negative corner radii are clamped to zero. (I130c7, b/168762961)
- Refactored DrawScope and
ContentDrawScope to be interfaces
instead of abstract classes
- Created CanvasDrawScope implementation of DrawScope
- Refactored implementations of DrawScope to use CanvasScope instead
- Created DrawContext to wrap dependencies for DrawScope
- Removed deprecated methods on DrawScope (I56f5e)
- Box was made an inline function. (Ibce0c, b/155056091)
Version 1.0.0-alpha05
October 14, 2020
androidx.compose.material:material:1.0.0-alpha05
, androidx.compose.material:material-icons-core:1.0.0-alpha05
, and androidx.compose.material:material-icons-extended:1.0.0-alpha05
are released. Version 1.0.0-alpha05 contains these commits.
API Changes
- Popups and dialogs now inherit FLAG_SECURE from parent Window. Also added option to configure this explicitly (I64966, b/143778148, b/143778149)
- Modifier.swipeable has 56.dp thresholds for states by default now (Iab825, b/168610267)
- all scaffold states marked as @Stable. drawerGesturesEnabled in ScaffoldState moved to Scaffold itself. (I36645, b/168297016)
- Removes nullable type from Scaffold lambda parameters, you can use emptyContent() to represent no content for a given parameter. (I2b318, b/157633857, b/158551084)
Deprecates contentColor() and currentTextStyle() APIs, and replaces them with AmbientContentColor and AmbientTextStyle ambients respectively. You can access the current value by using
.current
on the ambient property, as with any other ambient. This was change was made for consistency and to avoid having multiple ways to accomplish the same thing. Additionally renames some ambient properties to better describe their purpose as follows:- ContentColorAmbient -> AmbientContentColor
- TextStyleAmbient -> AmbientTextStyle
- IndicationAmbient -> AmbientIndication
- EmphasisAmbient -> AmbientEmphasisLevels
- RippleThemeAmbient -> AmbientRippleTheme (I37b6d)
Adds AmbientElevationOverlay, allowing customizing / disabling the default elevation overlay applied to Surfaces in dark theme. (I5b74d)
Bug Fixes
- As part of the standardization of sentinel values for inline classes, rename Color.Unset to Color.Unspecified for consistency with other inline classes (I97611, b/169797763)
- TextOverflow.None is introduced. When overflow is None, Text won't handle overflow anymore, and it will report its actual size to LayoutNode. (I175c9, b/158830170)
- launchInComposition renamed to LaunchedTask to match Compose API guidelines (I99a8e)
- OnPositionedModifier is renamed to OnGloballyPositionedModifier and onPositioned() is renamed to onGloballyPositioned(). (I587e8, b/169083903)
Version 1.0.0-alpha04
October 1, 2020
androidx.compose.material:material:1.0.0-alpha04
, androidx.compose.material:material-icons-core:1.0.0-alpha04
, and androidx.compose.material:material-icons-extended:1.0.0-alpha04
are released. Version 1.0.0-alpha04 contains these commits.
API Changes
- Exposes InteractionState parameters in stateful Material components, to allow hoisting the state and reading / controlling the state. (Iaca5f, b/168025711, b/167164434)
- Changes the
*color
parameters on RadioButton and TriStateCheckbox to allow fully customizing the colors used in each state, as well as changing how the colors animate between states if desired. See the new animateDefault* color functions in CheckboxConstants and RadioButtonConstants for more information. (I1c532) - Renamed rememberBackdropState to rememberBackdropScaffoldState and added an additional param for the animation clock. Renamed the param backdropScaffoldState of BackdropScaffold to just scaffoldState. Renamed BackdropConstants to BackdropScaffoldConstants. (Ib644d)
- Added experimental BottomSheetScaffold component. (Ie02f0, b/148996320)
- Added experimental ModalBottomSheetLayout component. (Ic209e, b/148996320)
- Renames ButtonConstants/FloatingActionButtonConstants.defaultAnimatedElevation to defaultElevation, and now returns a Dp value instead of an AnimatedValue. (I5f3ed)
Bug Fixes
- Updated many Graphics APIs
- Updated scale and rotation transformation APIs to consume a single Offset parameter to represent the pivot coordinate instead of separate float parameters for the x/y coordinates in DrawScope and DrawTransform
- Removed Rect.expandToInclude and Rect.join methods
- Updated Radius documentation to say oval in addition to elliptical
- Added documentation to indicate the public constructor for the inline Radius class is not to be called directly but instead Radius objects should be instantiated through their function constructors
- Removed RoundRect APIs to query topRight, bottomRight, bottomCenter, etc.
- Deprecated Rect.shift in favor of Rect.translate
- Removed RoundRect.grow and Rect.shrink APIs
- Renamed RoundRect.outerRect to Rect.boundingRect
- Removed RoundRect.middleRect/tallMiddleRect/wideMiddleRect and Rect.isStadium methods
- Renamed RoundRect.longestSide to RoundRect.maxDimension
- Renamed RoundRect.shortestSide to RoundRect.minDimension
- Changed RoundRect.center to be a property instead of a function
- Updated RoundRect constructor to consume Radius properties instead of individual parameters for x/y radius values
- Removed Size APIs that assumed it was a Rectangle with origin at 0,0
- Added a destructing API to Radius
- Migrated various RoundRect extension functions to be properties instead
- (I8f5c7, b/168762961)
- foundation.Box was deprecated. Please use foundation.layout.Box instead. (Ie5950, b/167680279)
- Stack was renamed to Box. The previously existing Box will be deprecated in favor of the new Box in compose.foundation.layout. The behavior of the new Box is to stack children one on top of another when it has multiple children - this is different from the previous Box, which was behaving similar to a Column. (I94893, b/167680279)
- Box decoration parameters have been deprecated. If you want to have decorations/padding on your box, use Modifiers instead (Modifier.background, Modifier.border, Modifier.padding) (Ibae92, b/167680279)
- Updated many Graphics APIs
- Updated DrawScope APIs with scoped transformation methods to indicate that the transformation is only applied within the callback and removed after the callback is invoked
- Updated clipPath documentation to refer to Path instead of rounded rectangle
- Fixed spacing in documentation for right parameter in clipPath
- Renamed DrawScope.drawCanvas to drawIntoCanvas and removed size parameter
- Renamed dx/dy parameters in inset method to horizontal and vertical
- Added inset overload that provides the same inset value to all 4 bounds
- Removed documentation on inset method indicating that inset would be applied to all 4 sides
- Updated documentation for Rect class
- Updated comments on Rect parameters to match kdoc style
- Removed Rect.join and Rect.expandToInclude
- Created overload for Rect.translate(offset) and deprecated Rect.shift
- (If086a, b/167737376)
- We prevented static imports of contents of layout scopes (e.g. alignWithSiblings in RowScope). The explicit scope alternative should be used instead:
with(RowScope) { Modifier.alignWithSiblings(FirstBaseline) }
. (I216be, b/166760797)
Version 1.0.0-alpha03
September 16, 2020
androidx.compose.material:material:1.0.0-alpha03
, androidx.compose.material:material-icons-core:1.0.0-alpha03
, and androidx.compose.material:material-icons-extended:1.0.0-alpha03
are released. Version 1.0.0-alpha03 contains these commits.
API Changes
- Renames
BottomNavigationItem
'sonSelect
parameter toonClick
(I91925, b/161809324) - Adds InteractionState parameter to BottomNavigationItem and Tab, allowing hoisting this state and adjusting how the component appears in different states. (Ia3e9e, b/168025711)
- Removes
disabledBackgroundColor
anddisabledContentColor
parameters from buttons. You should instead use the new default color functions inside ButtonConstants. If you are already setting contentColor / backgroundColor explicitly, you should instead use these default functions and customize some / all of the parameters to avoid overwriting the color for both enabled / disabled states. (If9b52) - Textfield's background color does not implicitly apply transparency alpha anymore. Instead, any color provided through the backgroundColor parameter will be applied directly. (Iecee9, b/167951441)
- InnerPadding was renamed to PaddingValues. (I195f1, b/167389171)
- The params
resistanceFactorAtMin
andresistanceFactorAtMax
inModifier.swipeable
were replaced with a single resistance param. A newdefaultResistanceConfig
method was added inSwipeableConstants
. (I54238) - Adds animated stateful elevation support for Button and FloatingActionButton. The elevation now animates between default and pressed states. To customize the elevation between states, please use
ButtonConstants.defaultAnimatedElevation()
andFloatingActionButtonConstants.defaultAnimatedElevation()
instead of setting a flat Dp value in all cases. (I37925) - Label became an optional parameter inside TextField and OutlinedTextField (I267f6, b/162234081)
Bug Fixes
- Global testing functions such as
onNode
orwaitForIdle
are now deprecated, please migrate to their new counterparts that are defined on ComposeTestRule (I7f45a) - DpConstraints and APIs using it were deprecated. (I90cdb, b/167389835)
- The parameters minWidth and maxWidth of widthIn were renamed to min and max. Similarly for preferredWidthIn, heightIn, preferredHeightIn. (I0e5e1, b/167389544)
- Remove scroll forward/backward semantics actions. Added steps in AccessibilityRangeInfo. (Ia47b0)
- Usages of gravity were consistently renamed to align or alignment in layout APIs. (I2421a, b/164077038)
- Added onNode and other global methods on ComposeTestRule as the current global ones are going to be deprecated. (Ieae36)
- Moved
createAndroidComposeRule
andAndroidInputDispatcher
fromandroidx.ui.test.android
toandroidx.ui.test
(Idef08, b/164060572)
Version 1.0.0-alpha02
September 2, 2020
androidx.compose.material:material:1.0.0-alpha02
, androidx.compose.material:material-icons-core:1.0.0-alpha02
, and androidx.compose.material:material-icons-extended:1.0.0-alpha02
are released. Version 1.0.0-alpha02 contains these commits.
API Changes
- Added an experimental BackdropScaffold component. (Iad908)
Bug Fixes
- Matrix4 was replaced with Matrix. All other parts of vectormath package have been removed. (Ibd665, b/160140398)
Version 1.0.0-alpha01
August 26, 2020
androidx.compose.material:material:1.0.0-alpha01
, androidx.compose.material:material-icons-core:1.0.0-alpha01
, and androidx.compose.material:material-icons-extended:1.0.0-alpha01
are released. Version 1.0.0-alpha01 contains these commits.
Known Issue
= The first character in a material TextField
cannot be removed using a backspace (b/165956313)
Version 0.1.0-dev
Version 0.1.0-dev17
August 19, 2020
androidx.compose.material:material:0.1.0-dev17
, androidx.compose.material:material-icons-core:0.1.0-dev17
, and androidx.compose.material:material-icons-extended:0.1.0-dev17
are released. Version 0.1.0-dev17 contains these commits.
API Changes
- Previously deprecated RadioGroup and RadioGroupItems have been removed. Use Row and RadioBotton instead (I381b7, b/163806637)
- Removed onFocusChanged callbacks from TextField. Use Modifier.focusObserver instead. (I51089, b/161297615)
- Modifier.drawBorder has been deprecated. Use Modifier.border instead. Border data class has been replaced by BorderStroke (I4257d, b/158160576)
- Renamed some properties in SwipeableState: swipeTarget -> targetValue, swipeProgress -> progress, swipeDirection -> direction. Added a rememberSwipeableState function for creating SwipeableStates. (I2fc9c, b/163129614, b/163132293)
- Snackbar support with positioning and proper queueing has been added. Access it via
SnackbarHostState.showSnackbar
suspend function. Additionally:- SnackbarHost components has been added. It hosts Snackbars based on the state and is responsible for transition between snackbars.
- SnackbarHostState has been added to allow for control over snackbars, snackbars hosts and to decouple it from the ScaffoldState. you can access this state via
scaffoldState.snackbarHostState
as well. - Snackbar overload has been added to support common interface between snackbarHostState and snackbars itself. (I79aaa)
- Adds enabled parameter to IconButton, and reorders parameters in IconToggleButton (I0a941, b/161809385, b/161807956)
- ListItem version with String-based API has been removed. Use slot version instead. (Ib8f57, b/161804681)
- Removed deprecated FilledTextField component. Please use TextField instead to get the Material Design implementation of the Filled text field. (I5e889)
- AlertDialog now uses FlowRow for buttons (I00ec1, b/161809319, b/143682374)
- Added params in Modifier.swipeable for changing the amount of resistance when swiping past the bounds. Removed [min/max]Value params. (I93d98)
- Added backgroundColor parameter to LinearProgressIndicator and removed internal padding from CircularProgressIndicator. Added new ProgressIndicatorConstants.DefaultProgressAnimationSpec which can be used as the default AnimationSpec when animating progress between values (If38b5, b/161809914, b/161804677)
- Optional param velocityThreshold added to Modifier.swipeable. (I698ba)
- bottomBarSize, fabSize and others and not available anymore in ScaffoldState. Use Modifier.onPosition instead on the component you'd like to know the size of. contentColor and Modifier pamateres have been added to Scaffold (Ic6f7b, b/161811485, b/157174382)
- Renames and reorders some parameters in Tab for consistency with other APIs (Ia2d12, b/161807532)
- Splits TabRow into TabRow and ScrollableTabRow, removing isScrollable from TabRow. Also exposes edgePadding in ScrollableTabRow, which allows controlling the free space before / after the tabs. (I583e8, b/161809544)
- The
TabRow
object has been removed, replacing it with TabConstants. TabRow.TabPosition has moved to be top level (TabPosition), and indicatorContainer has been renamed toindicator
. See the samples and documentation for detailed information on how to use the updated API, and defaults. (I54d45, b/161809544) - The thresholds param in Modifier.swipeable was tweaked; it now takes a pair of states (of type T) and returns the threshold between them in the form of a ThresholdConfig. A param dismissThresholds was added to SwipeToDismiss, which is a lambda (DismissDirection) -> ThresholdConfig. (Ie1080)
- Slider has more colors for granular customization (I73e64, b/161810475)
- Card's color param was renamed to backgroundColor (I01fc1, b/161809546)
- Snackbar has customizable background and content colors now (I238f2, b/161804381)
- modifier, backgroundColor, contentColor and scrimColor customization params has been added to Drawers (I23655, b/161804378)
- The
state { ... }
composable is now deprecated in favor of explicit calls toremember { mutableStateOf(...) }
for clarity. This reduces the overall API surface and number of concepts for state management, and matches theby mutableStateOf()
pattern for class property delegation. (Ia5727) - Button's padding param was renamed to contentPadding (Id252e, b/161809394)
- Add an experimental material component SwipeToDismiss. (I129e5)
Bug Fixes
- Removed
onChildPositioned
andOnChildPositionedModifier
. Developers should useonPositioned
andOnPositionedModifier
on the child layout instead. (I4522e, b/162109766) - Added mergePolicy lambda to SemanticsPropertyKey. This can be used to define a custom policy for mergeAllDescendants semantics merging. The default policy is to use the parent value if already present, otherwise the child value. (Iaf6c4, b/161979921)
- IntSize is now an inline class (I2bf42)
PlacementScope.placeAbsolute()
was renamed toPlacementScope.place()
, and the previousPlacementScope.place()
was renamed toPlacementScope.placeRelative()
. As a result, thePlacementScope.place()
method will not automatically mirror the position in right-to-left contexts anymore. If this is desired, usePlacementScope.placeRelative()
instead. (I873ac, b/162916675)- Deprecated PxBounds in favor of Rect. Updated all usages of PxBounds with rect and added proper deprecate/replace with annotations to assist with the migration. (I37038, b/162627058)
- Renamed RRect to RoundRect to better fit compose naming patterns Created similar function constructors to RRect and deprecated RRect function constructors (I5d325)
Version 0.1.0-dev16
August 5, 2020
androidx.compose.material:material:0.1.0-dev16
, androidx.compose.material:material-icons-core:0.1.0-dev16
, and androidx.compose.material:material-icons-extended:0.1.0-dev16
are released. Version 0.1.0-dev16 contains these commits.
API Changes
- Colors is now a final class instead of an interface. Instead of extending and providing a custom implementation, you should create a new ambient for your custom theme object, and access the theme object through the new ambient in your components, similar to how MaterialTheme works internally. (Ibae84)
- Renamed ColorPalette to Colors, to better map to the Material color system and remove confusion over ColorPalette being a 'generic' theming object, as opposed to being a specific implementation of the Material color system. Additionally renames lightColorPalette and darkColorPalette to lightColors and darkColors respectively. (I9e976, b/161812111)
- Renames BottomNavigationItem's
text
parameter tolabel
,onSelected
toonSelect
,activeColor
toselectedContentColor
,inactiveColor
tounselectedContentColor
and updates parameter ordering to match guidelines. (Icb605, b/161809324) Modifier.stateDraggable
was completely reworked and renamed to Modifier.swipeable. A new SwipeableState class was introduced, and DrawerState and BottomDrawerState were refactored to inherit from it. [Modal/Bottom]DrawerLayout no longer takes an onStateChange parameter. (I72332, b/148023068)- foundation.shape.corner package were flatten to foundation.share (I46491, b/161887429)
- Added ExperimentalMaterialApi annotation. RippleTheme marked as Experimental (Ic5fa0, b/161784800)
- Material FilledTextField was renamed to TextField and foundational TextField was renamed to BaseTextField to make simplest desired API easy to discover and use (Ia6242, b/155482676)
Bug Fixes
- OnChildPositioned has been deprecated. Use OnPositioned on the child instead. (I87f95, b/162109766)
- Address broad API fixes (I077bc)
- Remove unused OffsetBase interface
- Align Offset and IntOffset classes to have a consistent API surface
- Rename IntOffset.Origin to IntOffset.Zero to be consistent with Offset API
- Moved nativeCanvas method off of Canvas interface to support consumers to create their own Canvas instances
- Created stub EmptyCanvas class to refactor DrawScope to be a non-null parameter instead of lateinit and ensure non-nullability of the field
- Renamed ClipOp enums to be Pascal Case
- Renamed FilterQuality enums to be Pascal Case
- Renamed StrokeJoin enums to be Pascal Case
- Renamed PointMode enums to be Pascal Case
- Renamed PaintingStyle enums to be Pascal Case
- Renamed PathFillType enums to be Pascal Case
- Renamed StrokeCap enums to be Pascal Case
- Updated DrawCache implementation to no longer use lateinit params
- Updated DrawScope to no longer use lazy delegation for fillPaint and strokePaint internal parameters
- Updated Image composable to avoid Box usage for less overhead
- Updated Outline class to have @Immutable annotations
- Updated PathNode to have @Immutable annotations for each path instruction
- Updated Vector subcomposition to remove redundant conditional checks for equality as compose already handles them
- Deprecated Rect companion constructor methods in favor of function constructors
- Updated Brush classes and function constructors with @Immutable and @Stable APIs
- Updated VertexMode enum to be PascalCase
- Updated DrawScope selectPaint method to conditionally overwrite stroke parameters on the paint if they have changed
- Updated Size to add destructuring API, rename UnspecifiedSize to Unspecified and removed unused methods
- Move dialog to ui (I47fa6)
- Removed
SemanticsNodeInteraction.performPartialGesture
. UseSemanticsNodeInteraction.performGesture
instead. (Id9b62) - Renamed
SemanticsNodeInteraction.getBoundsInRoot()
toSemanticsNodeInteraction.getUnclippedBoundsInRoot()
(Icafdf, b/161336532) - The APIs for right-to-left support has been updated. LayoutDirectionAmbient has been added, which can be used to read and change the layout direction. Modifier.rtl and Modifier.ltr have been removed. (I080b3)
- Modifier.deternimateProgress has been renamed to Modifier.progressSemantics (I9c0b4)
- Updates material-icons-extended with the latest icons added to Material.io/icons (I4b1d3)
- Require type T to be explicitly specified for transitionDefinition. (I1aded)
- Modifier.plus has been deprecated, use Modifier.then instead. 'Then' has a stronger signal of ordering, while also prohibits to type
Modifier.padding().background() + anotherModifier
, which breaks the chain and harder to read (Iedd58, b/161529964) - Renamed AndroidComposeTestRule to createAndroidComposeRule. (I70aaf)
- Add isFocused() and isNotFocused() SemanticsMatcher. (I0b760)
- Removed
BaseGestureScope.globalBounds
, which shouldn't be used from tests. Use coordinates local to the node with which you're interacting instead. (Ie9b08) - Fixed popup position on cut-out displays. (Idd7dd)
- Modifier.drawBackground has been renamed to Modifier.background (I13677)
Version 0.1.0-dev15
July 22, 2020
androidx.compose.material:material:0.1.0-dev15
, androidx.compose.material:material-icons-core:0.1.0-dev15
, and androidx.compose.material:material-icons-extended:0.1.0-dev15
are released. Version 0.1.0-dev15 contains these commits.
Dependencies Update
- To use the
0.1.0-dev15
version of Compose, you will need to update your dependencies according to the new code snippets shown above in Declaring dependencies.
API Changes
@Model
annotation is now deprecated. Use state and mutableStateOf as alternatives. This deprecation decision was reached after much careful discussion.Justification
Rationale includes but is not limited to:
- Reduces API surface area and concepts we need to teach
- More closely aligns with other comparable toolkits (Swift UI, React, Flutter)
- Reversible decision. We can always bring
@Model
back later. - Removes corner-case usage and difficult to answer questions about configuring
@Model
as things we need to handle @Model
data classes, equals, hashcode, etc.- How do I have some properties “observed” and others not?
- How do I specify structural vs. referential equality to be used in observation?
- Reduces “magic” in the system. Would reduce the likelihood of someone assuming system was smarter than it is (ie, it knowing how to diff a list)
- Makes the granularity of observation more intuitive.
- Improves refactorability from variable -> property on class
- Potentially opens up possibilities to do hand-crafted State-specific optimizations
- More closely aligns with the rest of the ecosystem and reduces ambiguity towards immutable or us “embracing mutable state”
Migration Notes
Almost all existing usages of
@Model
are fairly trivially transformed in one of two ways. The example below has a@Model
class with two properties just for the sake of example, and has it being used in a composable.@Model class Position( var x: Int, var y: Int ) @Composable fun Example() { var p = remember { Position(0, 0) } PositionChanger( position=p, onXChange={ p.x = it } onYChange={ p.y = it } ) }
Alternative 1: Use
State<OriginalClass>
and create copies.This approach is made easier with Kotlin’s data classes. Essentially, make all previously
var
properties intoval
properties of a data class, and then usestate
instead ofremember
, and assign the state value to cloned copies of the original using the data classcopy(...)
convenience method.It’s important to note that this approach only works when the only mutations to that class were done in the same scope that the
State
instance is created. If the class is internally mutating itself outside of the scope of usage, and you are relying on the observation of that, then the next approach is the one you will want to use.data class Position( val x: Int, val y: Int ) @Composable fun Example() { var p by state { Position(0, 0) } PositionChanger( position=p, onXChange={ p = p.copy(x=it) } onYChange={ p = p.copy(y=it) } ) }
Alternative 2: Use mutableStateOf and property delegates
This approach is made easier with Kotlin’s property delegates and the
mutableStateOf
API which allows you to create MutableState instances outside of composition. Essentially, replace allvar
properties of the original class withvar
properties withmutableStateOf
as their property delegate. This has the advantage that the usage of the class will not change at all, only the internal implementation of it. The behavior is not completely identical to the original example though, as each property is now observed/subscribed to individually, so the recompositions you see after this refactor could be more narrow (a good thing).class Position(x: Int, y: Int) { var x by mutableStateOf(x) var y by mutableStateOf(y) } // source of Example is identical to original @Composable fun Example() { var p = remember { Position(0, 0) } PositionChanger( position=p, onXChange={ p.x = it } onYChange={ p.y = it } ) }
(I409e8, b/152050010, b/146362815, b/146342522, b/143413369, b/135715219, b/143263925, b/139653744)
onFocusChange callback in text fields renamed to onFocusChanged (Ida4a1)
Added thresholds param in stateDraggable to specify thresholds between anchors. This was used to set a 56dp threshold in bottom drawer. Also BottomDrawerLayout now uses a separate BottomDrawerState enum. (I533fa)
Removes previously deprecated Modifier.ripple. Clickable now uses ripple as the default indication (if you have a MaterialTheme {} set in your application) so in most cases you can just use clickable and get ripple indication for free. If you need to customize the color / size / bounded parameter for the ripple, you can manually create a RippleIndication and pass it to clickable as the indication parameter. (I663b2, b/155375067)
Removed deprecated override of FilledTextField composable (I7f8f8)
Rename Button object (containing the defaults used by Button function) to ButtonConstants (I7c5f7, b/159687878)
Button's content slot now behaves as Row (useful when you need to have an icon with a text, see samples on Button how to write it) (I0ff10, b/158677863)
RadioGroup and RadioGroupItem have been deprecated. Use Box with Modifier.selectable, Row and Column to make proper set of radioButton choices by your design (I7f5cf, b/149528535)
Added Material Outlined Textfield (I1a518)
androidx.ui.foundation.TextFieldValue and androidx.ui.input.EditorValue is deprecated. TextField, FilledTextField and CoreTextField composables that uses that type is also deprecated. Please use androidx.ui.input.TextFieldValue instead (I4066d, b/155211005)
TabRow.TabPosition not contains position in Dp, not in IntPx (I34a07, b/158577776)
Replaced usage of IntPx with Int. Replaced IntPxPosition with IntOffset. Replaced IntPxSize with IntSize. (Ib7b44)
In order to consolidate the number of classes used to represent sizing information, standardize on usage of the Size class instead of PxSize. This provides the benefits of an inline class to leverage a long to pack 2 float values to represent width and height represented as floats. (Ic0191)
Deprecates Modifier.ripple. Clickable now uses ripple as the default indication (if you have a MaterialTheme {} set in your application) so in most cases you can just use clickable and get ripple indication for free. If you need to customize the color / size / bounded parameter for the ripple, you can manually create a RippleIndication and pass it to clickable as the indication parameter. (I101cd, b/155375067)
Scaffold API has been reworked: few parameters changed their name, added new parameters for better customization. Added getter to query sizes of Fab, TopBar and BottomBar (I0e7ce)
Added the DropdownMenu component in ui-material, a Material Design menu implementation. (I9bb3d)
Allow to show/hide software keyboard manually using SoftwareKeyboardController (Ifb9d6, b/155427736)
Modifier.indication has been added to foundation package. Use it to show press/drag/other indication on your custom interactable elements (I8425f, b/155287131)
Consolidated CanvasScope implementations so there is now just DrawScope and ContentDrawScope Renamed CanvasScope to DrawScope. Updated DrawScope to implement Density interface and provide LayoutDirection Deleted DrawScope subclass in ContentDrawScope Painter and PainterModifier have been updated to no longer maintain an RTL property themselves as DrawScope provides this already without manually providing it (I1798e)
Renames Emphasis.emphasize() to Emphasis.applyEmphasis() (Iceebe)
Disabled buttons now visually follows the Material Design specification (I47dcb, b/155076924)
FilledTextField gets ime action, visual transformation and keyboard type support (I1f9cf, b/155075201)
Adds strokeWidth parameter to CircularProgressIndicator to customize the stroke size. To change the stroke size (height) of a LinearProgressIndicator, you can use Modifier.preferredHeight() or another size modifier. (Icea16, b/154919081)
Adds strokeWidth parameter to CircularProgressIndicator to customize the stroke size. To change the stroke size (height) of a LinearProgressIndicator, you can use Modifier.preferredHeight() or another size modifier. (Icea16, b/154919081)
Added slot API for trailing and leading icons in the FilledTextField and handling of the error state (Ic12e0)
FAB's and Extended FAB's default color has been changed to MaterialTheme.colors.secondary. (I3b9b9, b/154118816)
Replaced all nullable Color uses in API with non-nullable and use Color.Unset instead of null (Iabaa7)
Renamed EdgeInsets to InnerPadding. Renamed innerPadding parameter of Material Buttons to paddding. (I66165)
Slider is now stateless. Users will need to pass and update state by themselves, just like in any other control. (Ia00aa)
StaticDrawer was removed. If you need it, use Box with material-spec'ed width instead (I244a7)
Added Material Design implementation of Filled Text Field (Ic75cd)
Added modifier param to ListItem and reordered params to promote trailing lambda body (I66e21)
Adds defaultFontFamily constructor parameter to Typography, allowing specifying the default font family that will be used for any provided TextStyles that do not have a family set. (I89d07)
Temporarily removed Material Data Tables from the API surface. (Iaea61)
Renamed paramaters in Divider composable (Ic4373)
children (Ia6d19)
Removes MaterialTheme.emphasisLevels, instead use EmphasisAmbient.current to retrieve the emphasis levels (Ib5e40)
Shape theming system is updated according to the Material design specification. Now you can provide small, medium and large shapes to be used by most of the components (Ifb4d1)
Changed MaterialTheme APIs such as MaterialTheme.colors(), MaterialTheme.typography() to be properties instead of functions. Remove parentheses from existing calls, no behavioral change is expected. (I3565a)
Refactored FloatingActionButton APIs to accept composable lambdas instead of primitives. See updated samples for usage information. (I00622)
add
enabled
param to Checkbox, Switch and Toggleable (I41c16)Ripple is now a Modifier. While Clickable is not yet converted the recommended usage is
Clickable(onClick = { ... }, modifier = ripple())
(Ie5200, b/151331852, b/150060763)Surface and Card were moved from androidx.ui.material.surface to androidx.ui.material (I88a6d, b/150863888)
Button, FloatingActionButton and Clickable now have a separate
enabled
param. Some of the params on Button were renamed or reordered. (I54b5a)Renamed Image to ImageAsset to better differentiate the difference between the Image data and the upcoming Image composable used to participate in layout and draw content. _Body:Created extension method on android.graphics.Bitmap, Bitmap.asImageAsset(), to create an instance of an ImageAsset useful for combining traditional Android application development with the compose framework (Id5bbd)
Removed Snackbar API with String parameters in favour of using the overload that accepts composable lambdas. See updated samples for usage information (I55f80)
Refactored Tab APIs to accept
text
andicon
lambdas, (Ia057e)Added BottomNavigation component, see the docs and samples for usage information (I731a0)
Added Icon, IconButton and IconToggleButton, removing AppBarIcon. You can directly replace existing usages of AppBarIcon with IconButton, and they will now have the correct touch target. See the samples for usage information, and see Icons for the provided Material Icons you can use directly with these components. (I96849)
Replaced ButtonStyle with distinct functions and removed text (string) overload. See updated samples for usage information. (If63ab, b/146478620, b/146482131)
rename
Border
modifier toDrawBorder
(I8ffcc)LayoutCoordinates no longer has a position property. The position property does not make sense when considering LayoutModifiers, rotation, or scaling. Instead, developers should use parentCoordinates and childToLocal() to calculate the transform from one LayoutCoordinate to another.
LayoutCoordinates uses IntPxSize for the size property instead of PxSize. Layouts use integer pixel sizes for layouts, so all layout sizes should use integers and not floating point values. (I9367b)
Breaking changes to the ambients API. See log and
Ambient<T>
documentation for details (I4c7ee, b/143769776)Scaffold material component has been added. Scaffold implements (I7731b)
Replaced DrawBorder in favor of Border Modifier (Id335a)
Bug Fixes
- FocusModifier is deprecated in favor of Modifier.focus, Modifier.focusRequester, Modifier.focusObserver. FocusState and FocusDetailedState are deprecated in favor of FocusState2 (I46919, b/160822875, b/160922136)
- VerticalScroller and HoriziontalScroller have been deprecated. Use ScrollableColumn and ScrollableRow for build-in experience with Column/Row behaviour and parameters, or Modifier.verticalScroll and Modifier.horizontalScroll on your own element. Similarly, ScrollerPosition has been deprecated in favor of ScrollState' (I400ce, b/157225838, b/149460415, b/154105299)
- Modifier.draggable and Modifier.scrollable APIs were reworked. DragDirection was removed in favor of Orientation. State required for scrollable has beed simplified. ScrollableState has been renamed to ScrollableController (Iab63c, b/149460415)
runOnIdleCompose
renamed torunOnIdle
(I83607)- Single-value semantics properties now use a calling style. For example, 'semantics { hidden = true }' is now written as: 'semantics { hidden() }'. (Ic1afd, b/145951226, b/145955412)
- Several testing APIs were renamed to be more intuitive. All findXYZ APIs were renamed to onNodeXYZ. All doXYZ APIs were renamed to performXYZ. (I7f164)
- Transition API has been changed to return a TransitionState instead of passing the TransitionState to children. This makes the API more consistent with animate() APIs. (I24e38)
- An IntBounds unit class has been added, representing integer pixel bounds from layout. The API of PopupPositionProvider has been updated to use it. (I0d8d0, b/159596546)
- A new optional flag useUnmergedTree was added to test finders. (I2ce48)
- Removed obsolete size testing APIs. (Iba0a0)
- Removed Shader inline class that wrapped the NativeShader expect class Renamed NativeShader to Shader. The wrapped Shader inline class did not add anything valuable to the API surface and was an inline class, so use the NativeShader class directly. (I25e4d)
- Popups, Dialogs and Menus are now inheriting the contextual MaterialTheme (Ia3665, b/156527485)
- Material DropdownMenu are now scrollable. (Ide699)
- Removed layout direction parameter from the measure block of the Layout() function. Layout direction is however available inside the callback through the measure scope object (Ic7d9d)
- Use AnimationSpec instead of AnimationBuilder in the top level APIs to clarify the concept of static animation specification -Improve the transition DSL by removing the lambda requirement for creating AnimationSpecs such as tween, spring. They instead take constructor params directly. -Improve the overall ease of use of AnimationSpec opening up constructors instead of relying on builders -Change the duration and delay for KeyFrames and Tween to Int. This eliminates unnecessary type casts and method overloading (for supporting both Long and Int). (Ica0b4)
- Switch now appears in a disabled state when
enabled
is set to false (If4624, b/155941869, b/159331694) - Modifier.tag was renamed to Modifier.layoutId, to avoid confusion with Modifier.testTag. (I995f0)
- Alignment line Int positions returned from Placeable#get(AlignmentLine) are now non-null. If the queried alignment line is missing, AlignmentLine.Unspecified will be returned. (I896c5, b/158134875)
Refactored Radius class to be an inline class. Removed companion creation methods in favor of function constructor with default parameter to have the radius along the y-axis match that of the mandatory x-axis radius parameter.
Updated DrawScope.drawRoundRect to consume a single Radius parameter instead of 2 separate float values for the radius along the x and y axis (I46d1b)
In order to consolidate the number of classes used to represent positioning information, standardize on usage of the Offset class instead of PxPosition. This provides the benefits of an inline class to leverage a long to pack 2 float values to represent x and y offsets represented as floats. (I3ad98)
Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters. Deleted Px class in its entirety (I3ff33)
Toggleable component has been deprecated. Use Modifier.toggleable instead (I35220, b/157642842)
Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (I086f4)
Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (Id3434)
Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (I97a5a)
Fixed onClick not being invoked for DropdonMenuItems. (I3998b, b/157673259)
MutuallyExclusiveSetItem has been deprecated. Use Modifier.selectable instead. (I02b47, b/157642842)
TestTag is now deprecated. Use Modifier.testTag instead. (If5110, b/157173105)
TextField's cursor has a blinking animation (Id10a7)
Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (I19d02)
VerticalScroller now provides Column out of the box. HorizontalScroller now provides Row out of the box. (Ieca5d, b/157020670)
Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (Iede0b)
Modifier.semantics has been undeprecated to allow usages for high level components. (I4cfdc)
DrawLayer modifiers api has been changed: outlineShape renamed to shape and has the RectangleShape default value and now non-nullable; clipToOutline renamed to clip; clipToBounds removed as it is the same as clip == true with RectangleShape (I7ef11, b/155075735)
Updated higher level compose APIs that expose a Canvas to expose CanvasScope instead. This removes the need for consumers to maintain their own Paint objects. For consumers that still require access to a Canvas they can use the drawCanvas extension method which provides a callback to issue drawing commands with the underlying Canvas. (I80afd)
AlignmentLineOffset composable is deprecated, please use relativePaddingFrom() modifier instead. CenterAlignmentLine composable is removed. (I60107)
WithConstraints trailing lambda API has been changed. Now instead of two params it has a receiver scope which in addition to constraints and layoutDirection provides minWidth, maxWidth, minHeight and maxHeight properties in Dp (I91b9a, b/149979702)
Added defaultMinSizeConstraints layout modifier, which sets size constraints to the wrapped layout only when the incoming corresponding constraints are unspecified (0 for min constraints and infinity for max constraints). (I311ea, b/150460257)
FocusManagerAmbient is removed. Use FocusModifier.requestFocus to obtain focus. (Ic4826)
Created CanvasScope API that wraps a Canvas object to expose a stateless, declarative drawing API surface. Transformations are contained within their own receiver scope and sizing information is also scoped to corresponding inset bounds. It does not require a consumer to maintain its own Paint state object for configuring drawing operations.
Added CanvasScopeSample as well as updated the demo app to include a declarative graphics demo (Ifd86d)
Add cursor color customisation to the TextField (I6e33f)
TextFieldValue used with TextField can now be survive activity recreation when used like this:
var text by savedInstanceState(saver = TextFieldValue.Saver) { TextFieldValue() }
(I5c3ce, b/155075724)Renamed LayoutModifier2 to LayoutModifier. (Id29f3)
Removed deprecated LayoutModifier interface. (I2a9d6)
Replaced CoreTextField/TextField focusIdentifier parameter with FocusNode in order to integrate with focus subsystem. (I7ea48)
Intrinsic measurements functions in Layout and LayoutModifier2 have an IntrinsicMeasureScope receiver now which provides intrinsics query API with implicitly propagated layout direction. (Id9945)
New Modifier.zIndex() is added to control the drawing order of the children within the same parent layout. elevation property on DrawLayerModifier is renamed to shadowElevation and doesn't control the drawing order anymore. The params order fo DrawShadow is changed: elevation is now the first one and the shape is the second one with a RectangleShape default. (I20150, b/152417501)
RectangleShape moved from androidx.ui.foundation.shape.* to androidx.ui.graphics.* (Ia74d5, b/154507984)
TextField API update - merged onFocus and onBlur callbacks into a single onFocusChange(Boolean) callback with parameter (I66cd3)
Added verticalGravity and horizontalGravity parameters to Row and Column, respectively. (I7dc5a)
Updated wrapContentWidth and wrapContentHeight to expect vertical or horizontal Alignment rather than any Alignment. The gravity modifier was updated to accept vertical or horizontal Alignment. Row, Column and Stack were updated to support custom continuous Alignments. (Ib0728)
Created PixelMap API to support querying pixel information from an ImageAsset. (I69ad6)
Removes ProvideContentColor, instead just use ContentColorAmbient directly with
Providers
(Iee942)ui-text-compose module is renamed as ui-text. ui-text now contains CoreText and CoreTextField composables (Ib7d47)
ui-text module is renamed as ui-text-core (I57dec)
Moved ui-framework/CoreText, CoreTextField composables under ui-text-compose. You might want to include ui-text-compose in your project. (I32042)
Improve DrawModifier API:
- Made the receiver scope for draw() ContentDrawScope
- Removed all parameters on draw()
- DrawScope has same interface as former CanvasScope
- ContentDrawScope has drawContent() method (Ibaced, b/152919067)
runOnIdleCompose
andrunOnUiThread
are now global functions instead of methods on ComposeTestRule. (Icbe8f)[Mutable]State property delegate operators moved to extensions to support Kotlin 1.4 property delegate optimizations. Callers must add imports to continue using
by state { ... }
orby mutableStateOf(...)
. (I5312c)Added positionInParent and boundsInParent for LayoutCoordinates. (Icacdd, b/152735784)
ColoredRect has been deprecated. Use Box(Modifier.preferredSize(width, height).drawBackground(color)) instead. (I499fa, b/152753731)
Renamed LayoutResult to MeasureResult. (Id8c68)
Added LayoutModifier2, a new API for defining layout modifiers; deprecated LayoutModifier (If32ac)
Replaced Modifier plus operator with factory extension functions (I225e4)
Draggable has been moved to modifier (Id9b16, b/151959544)
ParentData composable is deprecated. You should either create a modifier which implements ParentDataModifier interface, or use LayoutTag modifier if you simply need to tag layout children to recognize them inside the measure block. (I51368, b/150953183)
Deprecated Center composable. It should be replaced either with the LayoutSize.Fill + LayoutAlign.Center modifier, or with one of the Box or Stack composables with suitable modifiers applied (Idf5e0)
Added VectorPainter API to replace existing subcomposition API for vector graphics. Result of subcomposition is a VectorPainter object instead of a DrawModifier. Deprecated previous DrawVector composables in favor of VectorPainter.
Renamed Image(Painter) API to PaintBox(Painter) Created Vector composable that behaves like the Image composable except with a VectorAsset instead of an ImageAsset (I9af9a, b/149030271)
Renamed LayoutFlexible to LayoutWeight. Renamed tight parameter to fill. (If4738)
Removed RepaintBoundary in favor of DrawLayerModifier (I00aa4)
DrawVector has been changed from a regular composable function to returning a Modifier drawVector() that will draw the vector as a background to a layout. (I7b8e0)
The Opacity composable function has been replaced with the drawOpacity modifier. (I5fb62)
Replace composable function Clip with modifier drawClip(). DrawClipToBounds is a convenient modifier to use when you only need to clip to the layer bounds with a rectangle shape. (If28eb)
Replaced DrawShadow composable function with drawShadow() modifier. Shadows are now drawn as part of LayerModifier. (I0317a)
Added LayerModifier, a modifier that allows adding a RenderNode for a Layout. It allows setting clipping, opacity, rotation, scaling, and shadows. This will replace RepaintBoundary. (I7100d, b/150774014)
androidx.compose.ViewComposer has been moved to androidx.ui.node.UiComposer androidx.compose.Emittable has been removed. It was redundant with ComponentNode. androidx.compose.ViewAdapters has been removed. They are no longer a supported use case. Compose.composeInto has been deprecated. Use
setContent
orsetViewContent
instead. Compose.disposeComposition has been deprecated. Use thedispose
method on theComposition
returned bysetContent
instead. androidx.compose.Compose.subcomposeInto has moved to androidx.ui.core.subcomposeInto ComponentNode#emitInsertAt has been renamed to ComponentNode#insertAt ComponentNode#emitRemoveAt has been renamed to ComponentNode#removeAt ComponentNode#emitMode has been renamed to ComponentNode#move (Idef00)Created Image composable to handle sizing/layout in addition to drawing a given ImageAsset to the screen. This composable also supports drawing any arbitrary Painter instance respecting its intrinsic size as well as supporting a given fixed size or minimum size (Ibcc8f)
Deprecated Wrap composable. It can be replaced either with the LayoutAlign modifier or with the Stack composable (Ib237f)
WithConstraints got LayoutDirection parameter (I6d6f7)
Made the layout direction be propagated from parent layout node to children. Added layout direction modifier. (I3d955)
Stack component supports right-to-left directionality (Ic9e00)
DrawShape composable was removed. Use DrawBackground modifier instead. (I7ceb2)
Support right-to-left direction in LayoutPadding modifier (I9e8da)
Added AdapterList, a scrolling list component that only composes and lays out the visible items. Currently known issues include that it is vertical-only and does not fully handle all cases of changes to its children. (Ib351b)
Updated the
ComposeFlags.COMPOSER_PARAM
flag to betrue
, which will change the code generation strategy for the compose plugin. At a high level, this causes @Composable functions to be generated with an additional synthetic parameter, which is passed through to subsequent @Composable calls in order for the runtime to properly manage execution. This is a significant binary breaking change, however, should preserve source-level compatibility in all sanctioned usage of compose. (I7971c)Added Canvas component. This composable takes up some size (provided by user) and allows you to draw using CanvasScope (I0d622)
Density and DensityScope were merged into one interface. Instead of ambientDensity() you can now use DensityAmbient.current. Instead of withDensity(density) just with(density) (I11cb1)
Changed LayoutCoordinates to make providedAlignmentLines a Set instead of a Map and have LayoutCoordinates implement the get() operator instead for retrieving a value. This makes it easier for modifiers to modify one or more value of the set without creating a new collection for each modifier. (I0245a)
Scrollers now exhibit native Android fling motion behavior. (I922af, b/147493715)
Improvements to the API surface of Constraints (I0fd15)