Status Update
Comments
lp...@google.com <lp...@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.
al...@gmail.com <al...@gmail.com> #5
an...@google.com <an...@google.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).
al...@gmail.com <al...@gmail.com> #7
In response to
I think there would still be a problem using rememberSaveable
though. Because for example consider:
- You start out in landscape in a list screen
- You scroll down a tiny bit in the list screen causing the top app bar to animate its color
- You rotate the device to portrait (and let's assume the list is small enough such that the entire list is shown, making the list no longer scrollable).
The desired behavior here would be that the top app bar would switch back to its initial state since the scroll position in portrait has now become 0, right?
So seems like there would need to be some way to have the top app bar and scroll position linked somehow...
sg...@google.com <sg...@google.com>
sg...@google.com <sg...@google.com>
ap...@google.com <ap...@google.com> #8
Branch: androidx-main
commit e260141f2a679c33bfbe576d3a73fd4338d54d1a
Author: Shalom Gibly <sgibly@google.com>
Date: Fri May 06 12:50:36 2022
Adds support for saving a top app bar state
- Adds a TopAppBarScrollState and use it inside the
TopAppBarScrollBehavior implementations.
- The state is provides a Saver and used by a rememberSaveable to
maintain the app bar position on configuration change.
Test: AppBarTest
Bug: 216160958
Relnote: "Supports maintaining the top app bar position on configuration
change."
Change-Id: I104599fa724196bbf1fec1bfa424a2a70abaf2fe
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/AppBarSamples.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt
M compose/material3/material3/api/current.txt
M compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/CatalogScaffold.kt
M compose/material3/material3/api/public_plus_experimental_current.txt
M compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/AppBarTest.kt
M compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/DemoApp.kt
sg...@google.com <sg...@google.com> #9
The main part of this issue was fixed, and we made changes to the API to support it.
Example usage:
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarScrollState())
SmallTopAppBar(
....
scrollBehavior = scrollBehavior
) ...
We may still have issues with cases mentioned at
al...@gmail.com <al...@gmail.com> #10
Does it make sense to create a separate issue to track the remaining bug?
Description
When you scroll a screen using a material3 top app bar, the top app bar's scroll container color changes. However, if you rotate the screen afterwards, the
LazyColumn
's scroll position will persist but the top app bar's color will reset back as if the screen was not scrolled at all.I attached a video illustrating the problem. The video is taken from the material demo app in AOSP, specifically this demo here (I made the app bar's scroll container color red to make it more obvious).