lib
03/20/2021, 8:05 AMRafs
03/20/2021, 8:38 AMColton Idle
03/20/2021, 12:29 PMval collapsedPathData = "M 12 13.17 L 7.41 8.59 L 6 10 L 12 16 L 18 10 L 16.59 8.59 L 12 13.17"
val collapsedPathNodes = remember { addPathNodes(collapsedPathData) }
Icon(
contentDescription = "",
painter = rememberVectorPainter(24.dp, 24.dp, 24f, 24f,) { _, _ ->
Path(pathData = collapsedPathNodes, fill = SolidColor(Color.Red),) }
)
smallshen
03/20/2021, 12:38 PMNamig Tahmazli
03/20/2021, 3:18 PM@Composable
fun Test() {
var items by remember {
mutableStateOf(
mutableListOf(
1,
2,
3,
)
)
}
LazyColumn {
items(items) {
Box(
modifier = Modifier
.fillMaxWidth()
.height(100.dp)
.clickable {
val list = items
list[0] = 6
items = list // this does not make the list to recompose
items = mutableListOf(6,2,3) // this does not work either
items = mutableListOf(6,3,2) // this makes the list to recompose
},
contentAlignment = Alignment.Center,
) {
Text(text = it.toString(), fontSize = 50.sp)
}
}
}
}
If you know why or got an idea please let me know.
P.S. Compose version is 1.0.0-beta02
Deepak Gahlot
03/20/2021, 4:11 PMjava.lang.IllegalStateException: ViewModelStore should be set before setGraph call
Vsevolod Ganin
03/20/2021, 4:29 PMSideEffect
for atomicity on operation on local state? The doc is a bit unclear:
SideEffect can be used to apply side effects to objects managed by the composition that are not backed by snapshots so as not to leave those objects in an inconsistent state if the current composition operation fails.So this applies also to snapshot-backed objects when we need to make atomic change on them, right?
Ngenge Senior
03/20/2021, 6:37 PMStanley Gomes
03/20/2021, 6:37 PMAnimatedVisibility
composables like here to slide in/out the composables
My issue is that only the top AnimatedVisibility
plays the animation. I would like to play them both in parallel so it looks like a seamless sliding in and out transition like a viewPager. Thanks!Adam Powell
03/20/2021, 6:44 PMColton Idle
03/20/2021, 7:02 PMNat Strangerweather
03/20/2021, 9:45 PMTash
03/21/2021, 3:36 AMdp
declarations, top level constants named in PascalCase etc., that we see used in the Compose source code. Is Compose declarative-tree style programming heralding a new set of coding styles/conventions for Kotlin? Wondering if anyone has had to justify “this is how its done in Compose” with regards to style/convention to their coworkers who may not be too familiar with Compose just yet.theapache64
03/21/2021, 8:03 AMcarbaj0
03/21/2021, 3:21 PMColton Idle
03/21/2021, 5:18 PMShivam Sethi
03/21/2021, 8:08 PMmatch_parent
for height and width not sure how can achieve that here, it just put black screen top and bottom but preview size remains the same if I do Modifier.fillmaxSize()
Jakub Ledwon
03/21/2021, 9:18 PMinfiniteRepetable
: I'm using tween
as animation
and while having durationMillis < 1000*48
(48s) everything works perfectly fine, but while trying to animate with durationMillis
greater than 48s (which seems super weird), it justs snaps from initialValue
to targetValue
. Do you have any idea why is it not working correctly? Am i doing something wrong? Here is super simple Composable
that allows to reproduce my problem:
@Composable
fun Test() {
val infTrans = rememberInfiniteTransition()
val value = infTrans.animateFloat(
initialValue = 0f, targetValue = 1f, animationSpec = infiniteRepeatable(
animation = tween(1000 * 60, easing = LinearEasing),
)
)
Text(value.value.toString())
}
orangy
03/22/2021, 8:40 AMSmorg
03/22/2021, 8:58 AMLazyVerticalGrid
in a Column
in a ComposeView
that’s a child of a NestedScrollView
and I am getting this:
java.lang.IllegalStateException: Nesting scrollable in the same direction layouts like ScrollableContainer and LazyColumn is not allowed.
...
I have seen a couple of this in here as well, but can’t find any that matches the state of my layout. Please how can I fix this?krzysztof
03/22/2021, 10:03 AMLukas
03/22/2021, 11:40 AMConstraintLayout
. How can I prevent the text from getting out of bounds as in the screenshot? Constraining the the textend to parent.end
doesn't seem to work in this case.Chachako
03/22/2021, 2:59 PMState
in ViewModel
is much simpler than LiveData
. Should I use MutableState
in ViewModel
? Is this correct?Chachako
03/22/2021, 3:03 PMJorkoh
03/22/2021, 3:45 PMOlivier Patry
03/22/2021, 5:10 PMView.onSizeChanged()
), what is the DPI of the screen where my "view" is (≃`Context.resources.displayMetrics`)
→ I'm aware there is no such "view" in the 100% Compose world, what I'd like is the have such thing within the layout for the result of a given composableRick Regan
03/22/2021, 5:43 PMCrossfade
, but the "thumbs" do not (they abruptly disappear when the animation ends). Is there something I need to do differently to get them to fade as well?gagarin55
03/22/2021, 6:09 PMclhols
03/22/2021, 6:12 PMjava.lang.ClassNotFoundException: androidx.lifecycle.viewmodel.R$id
at com.android.tools.idea.rendering.classloading.RenderClassLoader.getNonProjectClassData(RenderClassLoader.java:218)
at com.android.tools.idea.rendering.classloading.RenderClassLoader.loadClassFromNonProjectDependency(RenderClassLoader.java:185)
...
at androidx.lifecycle.ViewTreeViewModelStoreOwner.set(ViewTreeViewModelStoreOwner.java:50)
at androidx.compose.ui.tooling.preview.ComposeViewAdapter.init(ComposeViewAdapter.kt:615)
Francois Morvillier
03/22/2021, 6:40 PMFrancois Morvillier
03/22/2021, 6:40 PMKirill Grouchnikov
03/22/2021, 6:57 PMFrancois Morvillier
03/22/2021, 7:32 PMval scrollState = rememberScrollState()
val selectedIndex = // compute the selected child index using scrollState.value and child layout info
Row(modifier = Modifier.horizontalScroll(scrollState)) {
// children declarations
for(i in 1..N) {
Child(i, selectedIndex)
}
}
The question is how to I get the layout positions of the children so I can compute selectedIndex?Kirill Grouchnikov
03/22/2021, 10:17 PMState
variable at the parent level which is updated in your measure pass.Francois Morvillier
03/22/2021, 11:01 PM