Status Update
Comments
al...@gmail.com <al...@gmail.com> #3
Thanks for the report!
al...@gmail.com <al...@gmail.com> #4
The release notes documentation has been edited to clarify this change in behavior for line height.
To support non-standard text sizes, we encourage users to follow the Material design system and use a different style = LocalTextStyle.current.copy(lineHeight = TextUnit.Unspecified)
, or create a custom Typography
entirely.
br...@monzo.com <br...@monzo.com> #5
al...@gmail.com <al...@gmail.com> #6
In my case, I have multiple font sizes in the same Text
(using SpanStyle
in AnnotatedString
). There are legitimate reasons for this. For example, when combining Chinese and English (phonetic) together (for language-learning purposes).
ae...@google.com <ae...@google.com>
ap...@google.com <ap...@google.com> #7
Branch: androidx-main
commit a234d18045d35a211dfceea56b20fece51dc34cb
Author: Alexandre Elias <aelias@google.com>
Date: Tue Feb 09 14:10:13 2021
Improve selection control APIs to support "passive embedding"
This makes the Switch/Checkbox/RadioButton lambdas nullable. If null,
then the entire "toggleable" modifier is removed, disabling click input
handling, Material ripple and accessibility semantics.
These are intended for use cases (as in the samples) where the control
is embedded within a larger row which handles the click action for it.
Note that this is distinct from "enabled", which is for use cases where
the UI is grayed out to indicate it cannot currently be interacted with
in any way.
Bug: 171819073
Test: "New 'whenNullLambda' tests in RadioButtonTest,
SwitchTest, and CheckboxUiTest"
Relnote: "Switch, Checkbox and RadioButton action lambdas are now
nullable. Checkbox-in-clickable-row samples updated to use this
feature."
Change-Id: If601b88cf4622111bca5f4927cbb86c7d300ebbf
M compose/material/material/api/current.txt
M compose/material/material/api/public_plus_experimental_current.txt
M compose/material/material/api/restricted_current.txt
M compose/material/material/samples/src/main/java/androidx/compose/material/samples/ListSamples.kt
M compose/material/material/samples/src/main/java/androidx/compose/material/samples/SelectionControlsSamples.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CheckboxUiTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Checkbox.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/RadioButton.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
ae...@google.com <ae...@google.com> #8
OK, after some discussion, we decided the suggested API change was a good one and landed it :)
Re:
Re: the radiobutton ripple videos in #3. In the latest Modifier.clearAndSetSemantics {}
around a radio-button-with-identical-non-nullable-lambda will continue to be a supported way of doing things.
Description
Consider a custom
ListItem
component that displays aRadioButton
at the start of its content, implemented something like this:The problem I have with this code is that I only want the
Row
to show up as focusable in TalkBack and Ionly
want the Row to have a ripple indication. In other words, I would like theRadioButton
to be treated just as a decorative icon inside theRow
that is not individually interactive at all.The problem with this code is that by passing
onClick
to both theRow
and theRadioButton
, both end up being interactive and clickable. However,RadioButton
requires the click listener to be non-null, so there is currently no way to workaround this using the current API.The only way that I’ve been able to workaround this is by creating a custom
RadioButton
component that accepts a nullableonClick
argument. This allows me to passnull
as the click listener in the code above, and internally theRadioButton
will do something likeif (onClick == null) Modifier else Modifier.selectable(...)
to ensure that it can be used as a non-interactive widget.This same issue also exists for
Checkbox
andSwitch
as well.