Status Update
Comments
jo...@google.com <jo...@google.com>
ga...@gmail.com <ga...@gmail.com> #3
Thanks for the report!
se...@google.com <se...@google.com>
se...@google.com <se...@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.
ha...@gmail.com <ha...@gmail.com> #5
se...@google.com <se...@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).
ha...@gmail.com <ha...@gmail.com> #7
I agree that ModalBottomSheetLayout(modifier.widthIn(max=800.dp), providesMaxWidth=false)
isn't a great experience, and could probably lead to bugs if you forget to specify both.
Another option could be to model the width with a sealed interface. This at least keeps it confined to one parameter, and I think it provides a simple enough API
sealed interface ModalBottomSheetWidth {
object Default : ModalBottomSheetWidth
object Fill : ModalBottomSheetWidth
data class Custom(val width: Dp) : ModalBottomSheetWidth // Not sure if this has a use-case or not
}
@Composable
fun ModalBottomSheetLayout(
sheetWidth: ModalBottomSheetWidth = ModalBottomSheetWidth.Default
...
) {
val widthModifier = when (sheetWidth) {
ModalBottomSheetWidth.Default -> Modifier.widthIn(max = 640.dp)
ModalBottomSheetWidth.Fill -> Modifier.fillMaxWidth()
is ModalBottomSheetWidth.Custom -> Modifier.width(sheetWidth.width)
}
}
se...@google.com <se...@google.com>
se...@google.com <se...@google.com>
ke...@google.com <ke...@google.com>
ap...@google.com <ap...@google.com> #8
Branch: androidx-main
commit 392df4fcb263770b411399a8342cb3afeeaa1d6d
Author: Kevin Truong <kevinctruong@google.com>
Date: Thu Sep 14 18:55:33 2023
[BottomSheet] Can override the maximum width of ModalBottomSheet and BottomSheetScaffold
Adding a new parameter, sheetMaxWidth, that can be used to specify the maximum width that the sheet would take up.
Dp.Unspecified can be passed in for sheetMaxWidth if a sheet that spans the entire width of the screen is desired.
Test: Adding a tests for ModalBottomSheet and BottomSheetScaffold that tests when Dp.Unspecified is passed in for sheetMaxWidth to ensure that the sheet spans the entire width, as well as different sheetMaxWidth values.
Bug: 266697696
Relnote: Adding a new sheetMaxWidth parameter that developers can set to specify a maximum width that the sheet will span. Dp.Unspecified can be passed in for the parameter if a sheet that spans the entire screen width is desired.
Change-Id: Ifb7c9ee4d0066e86787e8fcbf0d156b9f92e5cfb
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/BottomSheetScaffoldTest.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/ModalBottomSheetTest.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ModalBottomSheet.android.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/BottomSheetScaffold.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SheetDefaults.kt
jo...@google.com <jo...@google.com> #9
Kevin, your commit is for M3, right? This issue is for M2
ke...@google.com <ke...@google.com> #10
Oops, yes sorry this was implemented in M3 but not in M2. Will repoen this ticket and mark the other ticket for M3 as fixed. Thank you for catching this Jossi!
Description
Compose 1.4.0-alpha04 introduced a max width constraint on Material 3 guidelines say that this behaviour can be overriden if needed for large screens:
ModalBottomSheetLayout
. However, theFor larger screens, bottom sheets have a default max-width to prevent undesired layouts and awkward spacing. However, this can be overridden if needed.
I have designs that expect, and will take advantage of, the entire screen width in a bottom sheet, and would like to have this behaviour without creating my own implementation.
As noted in the issue related to adding the max width constraint, the Design & Quality section on developer.android.com seems to specify that the width should always be constrained (with links to Material 2).
I'm not sure what the intended behaviour here is as there seems to be a difference between Material 2 and 3. Since
ModalBottomSheetLayout
is incompose.material
and notcompose.material3
I assume it isn't based on Material 3. If that is the case, is there a plan to add a corresponding component incompose.material3
with a modal bottom sheet that can override the max width constraint?