Status Update
Comments
va...@google.com <va...@google.com> #3
Thanks for the report!
ma...@google.com <ma...@google.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.
de...@gmail.com <de...@gmail.com> #5
do...@gmail.com <do...@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).
va...@google.com <va...@google.com> #7
otherwise content code will have to check and adjust based on the top/bottom app bar presence, which is not ideal.
The usage I'm thinking of shouldn't have the content care if the top/bottom app bar is there.
Let's say the Scaffold
didn't interact with insets at all.
Then, the inner padding passed to the content will pass down the space information taken up by the app bars. That may or may not include the insets.
But what the content can do is do call consumedWindowInsets(innerPadding)
unconditionally. If there are app bars, then the height of those will be consumed so that they are not reapplied later. If there aren't app bars, then the innerPadding
will be empty, and the insets will be left available for an inner component to take into account.
I think that pass-through behavior should be available as an option for Scaffold
, to also handle the cases for the reasons highlighted above by others.
ma...@google.com <ma...@google.com> #8
re
With the changes, the entire screen is now reduced in size when the keyboard appears.
I'm not sure I follow what's happening in your case. This change handles no ime insets and ime insets should work as before. Please file a separate bug with the repro sample if you see something strange.
va...@google.com <va...@google.com> #10
Currently Scaffold
is including safeDrawing
, which includes IME insets as well.
So innerPadding
will contain the ime
insets (assuming there is no bottom bar).
If there is a bottom bar, it will depend on whether the bottom bar is handling the ime
insets or not.
ma...@google.com <ma...@google.com> #11
re Alex
But what the content can do is do call consumedWindowInsets(innerPadding) unconditionally.
calling consumedWindowInsets(innerPadding)
unconditionally would consume more than intended as it will include the top and bottom app bar heights, causing the amount of unconsumed insets to be smaller then the real insets are. This will cause ime and other insets to break potentially and show incorrect padding.
This is one of the reasons we might never promote the PaddingValues overload of consumeWindowInsets
, it is just too dangerous.
I'm looking into what would be a sensible shape of the API
ma...@google.com <ma...@google.com> #12
Currently Scaffold is including safeDrawing, which includes IME insets as well.
Ooooh, that's true. I don't think we want to handle ime at all here in the scaffold or in other places to be honest. Is there a reason to handle it there? Probably for snackbar only..
de...@gmail.com <de...@gmail.com> #13
I don't think we want to handle ime at all here in the scaffold or in other places to be honest. Is there a reason to handle it there?
It's horrible when ime is handled there that the bottom bar moves up. It looks really weird.
ma...@google.com <ma...@google.com> #14
It is a bug, we should only consume status and navigation bars, but not ime. It can be an opt-in behavior if desired.
ma...@google.com <ma...@google.com> #15
snackbar and fab problem will be adressed here:
ap...@google.com <ap...@google.com> #16
Branch: androidx-main
commit 82cc43345ae181e2b1d708627e42fd0313738efa
Author: Matvei Malkov <malkov@google.com>
Date: Mon Aug 29 18:15:05 2022
Adjust material inset logic to account for ime and to allow for scaffold opt-out.
This change makes sure scaffold is handling the insets well. Allows for opt-outs and doesn't interfere with the IME paddings.
While we are at it, this change adjusts other components to never account for IME padding as well, making it an opt-in behavior.
Fixes: 243713323
Test: added new for new API + adjusted existing
Relnote: Default components insets introduced in m3 components in beta01 version are no longer account for IME insets.
Relnote: material3 Scaffold component now has a contentWindowInsets parameter, allowing to specify the amount of insets to handle for the content slot.
Change-Id: Icf11a4169c801d2670d88066984328205f48bb4f
M compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ScaffoldTest.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.kt
M compose/material3/material3/api/public_plus_experimental_current.txt
A compose/material3/material3/api/restricted_current.ignore
M compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material/SystemBarsDefaultInsets.desktop.kt
M compose/material3/material3/api/restricted_current.txt
A compose/material3/material3/api/current.ignore
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/public_plus_experimental_1.0.0-beta02.txt
M compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/MaterialComponentsInsetSupportTest.kt
M compose/material3/material3/api/1.0.0-beta02.txt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.android.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Scaffold.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationRail.kt
M compose/material3/material3/api/restricted_1.0.0-beta02.txt
M compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/DemoApp.kt
M compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/ScaffoldSamples.kt
M compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/component/Component.kt
na...@google.com <na...@google.com> #17
This bug was linked in a change in the following release(s):
androidx.compose.material3:material3:1.0.0-beta02
va...@google.com <va...@google.com> #18
ma...@quantox.com <ma...@quantox.com> #19
Quick question, I have a problem with Scaffold not updating innerPadding as a result of me showing/hiding a topBar, so is this is a bug I should report or am I missing something?
Scaffold(
topBar = {
val showAppBar = true/false
if (showAppBar) TopAppBar() //topBar shows/hides as expected based on some state
}
) { innerPadding -> //but innerPadding never gets updated based on change in topBar visibility??
//some content that consumes innerPadding
}
If this is actually supposed to work this way I might be forced to move TopBar onto individual screens?
Description
Material3: 1.0.0-beta01
In the latest Material 3 release, insets are automatically handled by some components.
For the
Scaffold
in particular,safeDrawing
insets are added to the inner padding passed to thebody
, but there is no ability to configure this (unlike theTopAppBar
s,NavigationBar
andNavigationRail
).The current behavior isn't always desirable, since a top-level
Scaffold
may want to leave inset support up to individual screens, in which case it makes sense to leave some form of insets untouched to be consumed later (potentially via anotherScaffold
).I think it would make sense to avoid having
Scaffold
interact with insets at all directly, or at the very least, allow opting out of it.