Colton Idle
04/20/2022, 7:03 PMLazyLayout
API is introduced. This allows you to build your own components like LazyColumn
of LazyVerticalGrid
. Note that the API is in its early stages and can be changed in the future releases
• Bunch of updates to Paragraph, pointer input, Fonts
Material 3 updates
• material3-window-size-class
is a new library that provides support for window size classes: a set of opinionated viewport breakpoints for you to design, develop, and test resizable application layouts against.
• Lots of little updatesTolriq
04/20/2022, 7:11 PMandrew
04/20/2022, 8:11 PMInconsistency between the count of nodes tracked by the state (0) and the children count on the SubcomposeLayout (1). Are you trying to use the state of the disposed SubcomposeLayout?
in all of my lazy lists after scrolling after upgrading to alpha 08Tolriq
04/20/2022, 8:15 PMbbade_
04/20/2022, 8:45 PMBen Trengrove [G]
04/20/2022, 9:53 PMJan
04/20/2022, 10:30 PMval files = remember { File(parent).listFiles()!!.toList().chunked(4) }
LazyColumn {
items(files.size) {
Row {
files[it].forEach { video ->
Thumbnail(video, size)
}
}
}
}
The problem is that the thumbnail thing takes a bit to load however the lazy column either calls the thumbnail method all at once or I'm doing something wrong because it's not loading. If I only take 4 of files it loads a few seconds and its finebrabo-hi
04/21/2022, 12:06 AMandroidx.activity:activity-compose: 1.6.0-alpha01
?the great warrior
04/21/2022, 3:32 AMHarold Scissors
04/21/2022, 5:25 AM@Composable
fun CustomView(myObject: MyObject) { //some Compose UI }
If MyObject
isn't marked @Stable
will this method be recomposed regardless if the values of MyObject
have not change?jermainedilao
04/21/2022, 9:06 AMMor Amit
04/21/2022, 9:40 AMbounce
function, an extension of Modifier. The bounce
function receives a shouldBounce
boolean that indicates if I should start the animation.
I wonder if there is a better way to do that and move the shouldBounce
boolean into the Modifier. With my current implementation, I need to define a shouldBounce
boolean in every place that wants to use my bounce function.
Maybe there is a way to catch the click event on both Box and Modifier?
I attached some code examples in the first replyjean
04/21/2022, 10:38 AManimateFloatAsState
with 2 iterations but when the animation ends, the size of the box jumps to the targetValue
dimsuz
04/21/2022, 12:31 PMRow
and if a sum width of all of its children is less than screenWidth
I want to use .weight(1)
for them.
Otherwise I want to use .horizontalScroll()
on the Row
.
Is there a nice way to achieve this?
I thought about SubcomposeLayout
instead of Row
but I'm not sure, because I need to also manipulate Modifier
in this case (for scrolling)Nabeel
04/21/2022, 12:40 PMLazyColumn() {
Card() {
item{
//Some ui
}
items(myItems) { item ->
// item here
}
}
}
humbledroid
04/21/2022, 1:14 PMDropDownMenu
, that it uses Column, thus cannot have huge number of items, without allowing it to populate all items at once, and this will lead to frame drop and crashes. DropDownMenu
as of today cannot leverage LazyColumn
as intrinsic size for Subcomposelayouts
is not yet supported, and fixed height width cannot be given to the LazyList
in DropDownMenu
because of the use case.
The use case is to show list of countries and choose one of them, and for that I am using the DropDownMenu
but as the size of countries list is enough to make it draw after a few frame drop.
I found an issues similar to this, ISSUETRACKER and is closed as it works as intended, because this is not meant for long lists, i guess. maybe a time for LazyDropDownMenu
I tried replacing the Column
with LazyColumn
but that would not work because of the intrinsic measurements , and it works perfectly fine, when the height
and width
is supplied via modifier to LazyColumn
.Naga
04/21/2022, 5:40 PMJetpack Compose framework and Library development SHOULD declare hoisted state types as interfaces instead of abstract or open classes if they are not declared as final classes
at https://github.com/androidx/androidx/blob/androidx-main/compose/docs/compose-api-guidelines.md#default-policies-through-hoisted-state-objects
It is understood that keeping Extensibility of hoisted type in mind, it’s better to expose Interface instead of concrete types, but if for a given environment if Extensibility is not a priority can we use data
class a parameter to composables?
is this encouraged?
data class BarState {
val name: String
val avatarUrl: String
}
@Composable
fun Bar(barState: BarState) {
If its okay to use as above, Again its understood that we can’t have access to LocalContext or Theme objects inside data class, an easy workaround is
data class BarState(
val name: String
val avatarUrl: String
val contentColor: @Composable () -> Color = {
MaterialTheme.colors.primary
}
)
This makes the BarState
data class mutable, hence the input to composable too, is this pattern still has any value?
Have observed in the forum to avoid ever using [Mutable]State<T>
in a parameter list to composable
getFoo: () -> Foo
is always going to be a more flexible parameter than foo: State<Foo>
2. With this , if i can pas a function as a parameter to composable, why can’t i use same inside a data class?
Any feedback/ inputs will be greatly helpful.Mehdi Haghgoo
04/21/2022, 7:19 PMLilly
04/21/2022, 8:38 PMjava.lang.IllegalStateException: Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed.
...
val scrollState = rememberScrollState()
Column(
modifier = Modifier
.fillMaxHeight()
.verticalScroll(scrollState)
) {
Card(modifier = Modifier.fillMaxWidth())
Card(modifier = Modifier.fillMaxWidth()) {
LazyVerticalGrid() {}
}
}
The parent is the content slot of BottomSheetScaffold
. I know it has to do with the LazyVerticalGrid
, but both Cards measure the height by its content so I don't understand what the problem is.
EDIT:
Card(modifier = Modifier.fillMaxWidth().weight(1f, false))
Card(modifier = Modifier.fillMaxWidth().weight(1f, false)) {
LazyVerticalGrid() {}
}
Applying weight
on both Cards solves the exception but now the LazyVerticalGrid
is scrollable. I would like to wrap content height of the latter Card
, is this possible?Sean Proctor
04/22/2022, 1:32 AMJaime
04/22/2022, 3:57 AMjava.lang.IllegalArgumentException: Inconsistency between the count of nodes tracked by the state (0) and the children count on the SubcomposeLayout (5). Are you trying to use the state of the disposed SubcomposeLayout?
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.makeSureStateIsConsistent(SubcomposeLayout.kt:514)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:391)
Yves Kalume
04/22/2022, 10:31 AMRyan Simon
04/22/2022, 12:36 PMHorizontalPager
to work inside of a LazyColumn
? I've got a rather involved screen that has multiple HorizontalPagers
for images and for tabs. All of the content should be vertically scrollable. Screenshot in thread.nuhkoca
04/22/2022, 2:34 PMisPageTitleReached
and isContentScrolled
changed, right?
val isPageTitleReached by derivedStateOf {
remember {
lazyListState.firstVisibleItemScrollOffset > 500
}
}
val isContentScrolled by derivedStateOf {
remember {
lazyListState.firstVisibleItemScrollOffset > 600
}
}
mattinger
04/22/2022, 2:49 PM@ExperimentalAnimationApi
@Composable
fun rememberAnimatedNavController(
vararg navigators: Navigator<out NavDestination>
): NavHostController {
val animatedNavigator = remember { AnimatedComposeNavigator() }
return rememberNavController(animatedNavigator, *navigators)
}
I assume i would pass the resolve of a rememberBottomSheetNavigator() call?tad
04/22/2022, 9:04 PMLilly
04/23/2022, 3:01 PMTabRow
has swipe behavior for its content? I'm wondering because its documentation says yes but it doesn't has it actually.
To navigate between fixed tabs, tap an individual tab, or swipe left or right in the content area.
raghunandan
04/23/2022, 3:16 PMShakil Karim
04/23/2022, 5:04 PMcloseSheet
and openSheet
inside Composable because Main can recompose very often?
@Composable
fun Main() {
val closeSheet: () -> Unit = {
scope.launch {
scaffoldState.bottomSheetState.collapse()
}
}
val openSheet: (BottomSheetScreen) -> Unit = {
currentBottomSheet = it
scope.launch {
delay(100)
scaffoldState.bottomSheetState.expand()
}
}
if (scaffoldState.bottomSheetState.isCollapsed)
currentBottomSheet = null
}
Lilly
04/23/2022, 8:36 PMColumn(modifier = Modifier
.padding(24.dp)
.fillMaxSize()
.verticalScroll() // this causes the clipping
) {
Card(elevation = 16.dp) {}
}
Lilly
04/23/2022, 8:36 PMColumn(modifier = Modifier
.padding(24.dp)
.fillMaxSize()
.verticalScroll() // this causes the clipping
) {
Card(elevation = 16.dp) {}
}
bohregard
04/24/2022, 12:24 AMsetContent {
CardTestTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
Column(modifier = Modifier.padding(24.dp).fillMaxSize()) {
Card(elevation = 16.dp) {
Box(modifier = Modifier.padding(12.dp)) {
Text(
style = MaterialTheme.typography.h5,
text = "Connection and Communication"
)
}
}
}
}
}
}
Lilly
04/24/2022, 12:42 AMverticalScroll(rememberScrollState())
to the parent Container. I just figured out that it only happens when this Modifier is set.bohregard
04/24/2022, 12:45 AMLilly
04/24/2022, 12:48 AMbohregard
04/24/2022, 12:49 AM