Lilly
02/20/2021, 4:33 PMDecompose
in one of his recent blog posts. I was interested in decompose and had a look into this example but I can't figure out how it's restoring the scroll position of the LazyColumn
when moving from the details screen back to the list screen. I'm looking for hours but I can't find the responsible piece of code. Can some please have a look and give me a hint?
https://github.com/arkivanov/ComposeNavigatorExampleVivek Sharma
02/20/2021, 5:34 PMcolumn
, can I control the vertical spacing between them, is there a waykevindmoore
02/20/2021, 5:50 PMmzgreen
02/20/2021, 7:31 PMHalil Ozercan
02/20/2021, 11:38 PMSlackbot
02/21/2021, 1:41 AMAdriano Celentano
02/21/2021, 9:52 AMLaunchedEffect(key1 = Unit, block = {
while (isActive) {
delay(50)
horizontalAnimation.value = horizontalAnimation.value + 2.dp
}
})
Shakil Karim
02/21/2021, 10:10 AMLazyColumn(
state = scrollState,
modifier = Modifier.fillMaxSize()
) {
item {
LogCompositions("CompetitionDetailsScreenNew header")
//Some item
}
}
Emmanuel Oga
02/21/2021, 10:51 AMorangy
02/21/2021, 1:35 PMLazyVerticalGrid
with itemsIndexed
over a property which is mutableStateListOf
. Everything is working fine when I add items, but when I remove items via remove
or clear
on that list I get an exception trying to access non-existing items. It’s a call from inside the itemsIndexed
, looks like it didn’t notice collection has changed. Is it a known issue or am I doing something wrong?Samir Basnet
02/21/2021, 3:17 PMorangy
02/21/2021, 3:37 PMLazyVerticalGrid
. I would prefer to have GridCells
variant like FixedSize(32.dp, 40.dp)
out of the box, but there is none.
Can anyone give me a clue, please?robnik
02/21/2021, 4:32 PMSe7eN
02/21/2021, 6:29 PMCanvasElement
and two subclasses CanvasElement.Text
and CanvasElement.Image
. Then I have a list like val elements = mutableStateListOf<CanvasElement>()
.
How can I recompose my composables when I change an element in my list to the same element but a different property which is only present in CanvasElement.Text
and CanvasElement.Image
and not in CanvasElement
.
Something like this:
sealed class CanvasElement(open val id: String, open val position: Offset) {
data class Text(val size: Float, override val position: Offset, open val id: String): CanvasElement(id, position)
data class Image(val size: IntSize, override val position: Offset, open val id: String): CanvasElement(id, position)
}
val elements = mutableStateListOf<CanvasElement>()
fun modifyElement(id: String, newElement) {
// find index of id
...
elements[index] = newElement
}
Then if I modify one of my text elements by changing its size, I want my Text composable to recompose:
modifyElement((myElement as CanvasElement.Text).copy(size = newSize))
@Composable
fun Element(element: CanvasElement) {
when(element) {
is CanvasElement.Text -> Text("text", size = element.size) // does not recompose when size changes
is CanvasElement.Image -> ... // does not recompose when size changes
}
}
But the recomposition isn't happening and the text size stays the same. Is it not possible? Do I have to keep separate lists for CanvasElement.Text
and CanvasElement.Image
?Chachako
02/21/2021, 6:47 PMfindRenderObject().toImage()
in flutter, I really hope this exists, because the performance cost of cropping the widget area after using PixelCopy
to screenshot the entire window view may be expensive.
2. I'm not sure if there is an api on compose that can monitor the changes of all components, similar to the native View.doOnPreDraw
, if it does not exist, then I will try to refresh the blur by monitoring the changes of window view, but if it is invalid for compose, Then I may need to refresh every 100ms, which would be terrible!orangy
02/21/2021, 6:53 PMText
it has some space below the number. The text rectangle is centered, but not the text itself. How do I fix it?bruno.aybar
02/21/2021, 8:54 PMtransition
s had onStateChangeFinished
callback. Does anyone know if there's a similar callback on the new API?Lukas K-G
02/21/2021, 9:12 PMViewModel
and LiveData
and when should I use mutableStateOf
?Jason Inbody
02/21/2021, 9:43 PMimport androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
Not getting much from google were these renamed possibly? Or do i need to add a dep somewherekrzysztof
02/21/2021, 10:16 PMChachako
02/22/2021, 3:13 AMJason Ankers
02/22/2021, 4:28 AMLazyColumn
seems to cause an infinite recompose loop. Anyone know why this might be happening?Chachako
02/22/2021, 7:39 AMremember
. Should I wrap remember
in all object initialization places?Yuri Drigin
02/22/2021, 11:56 AMcomposable
but it doesn’t workMaciej Pigulski
02/22/2021, 2:41 PMColumn(modifier = Modifier.fillMaxSize())
is overriding background set in Colors(..., background = Color.Red, ...)
for the Material Theme. Not sure if it is strictly Column
releated but if I remove it from the view hierarchy I am able to see Color.Red
as the background. Column
that I am removing has no background of its own. I fail to pinpoint if there is some material color that is taken by default for Column
background. I have checked the source code and couldn't find any defaults taken f.e. from colorPrimary
or else. Now I see it as a bug but maybe I got something wrong..itnoles
02/22/2021, 3:27 PMjaqxues
02/22/2021, 4:26 PMmutableStateListOf<StateFlow<StateFulData>>()
or similar?Simone Summo
02/22/2021, 4:32 PMnavController.navigate("yourDirection")
to navigate from a composable to another and my version of navigate
don’t provide the right implementation.
I am using androidx.navigation:navigation-compose:1.0.0-alpha06
Ayomide
02/22/2021, 5:24 PMTextDecoration
a separate colour from the text being decorated? TextDecorationescodro
02/22/2021, 6:05 PMTaskDetailActions
and pass the object instead of all the params.
Is there a better/more recommended solution?
Thanks a lot in advance! 😊escodro
02/22/2021, 6:05 PMTaskDetailActions
and pass the object instead of all the params.
Is there a better/more recommended solution?
Thanks a lot in advance! 😊ViewModels
to the components below.Ali Albaali
02/22/2021, 6:10 PMcontent: @Composable () -> Unit
as mentioned in this video▾
lewis
02/22/2021, 6:12 PMescodro
02/22/2021, 6:12 PMTash
02/22/2021, 10:06 PMTaskDetailActions
for the context of your component would be a better replacement for individual event lambdasfun TaskDetailRouter(state: TaskDetailRouterState, onAction: (TaskDetailRouterAction) -> Unit) { ... }