Vsevolod Ganin
09/20/2020, 12:40 PMClass 'androidx.compose.ui.geometry.Offset' is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler
. Please halp. I did everything including adding useIR = true
, freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"]
in all places, compose true
and all. How can I validate that IR is actually enabled?
Using Kotlin 1.4.10, Compose 1.0.0-alpha03Adriano Celentano
09/20/2020, 12:44 PMLayoutModifier
implementations just PainterModifier
i didnt understand what its good for ?Vinay Gaba
09/20/2020, 5:03 PMBecause of this, writes like this are not supported in Compose; by prohibiting those writes, we allow the framework to change threads to execute composable lambdas.I was wondering what “prohibiting those writes” means? Like I understand why we shouldn’t do it but how is the system enforcing it right now? I don’t see anything that’s stopping me from doing that.
andani
09/20/2020, 7:44 PMlib
09/21/2020, 2:16 AMPrashant Priyadarshi
09/21/2020, 6:44 AMScrollableColumn() {
LazyColumnFor(items = list) {item ->
getSampleDataRow(data = item)
}
}
Miguel Coleto
09/21/2020, 8:21 AMgeorgiy.shur
09/21/2020, 12:23 PMNamig Tahmazli
09/21/2020, 1:43 PMmattinger
09/21/2020, 7:43 PMbruno.aybar
09/22/2020, 5:39 AMtransitions
and transitionDefinitions
for a sample app I'm working on.
I noticed that I was having the same issues over an over while handling multiple transitions. Basically, transition(toState = , initState = )
is a bit confusing at first try. It's great for a single animation that triggers immediately (i.e. the Rally app circular animation). However, it's easy for the state to get out of sync / to cause undesired transitions.
I thought it may only be me, but I've seen the same problem in a post someone did. If you deep dive in the implementation, you'll notice:
• Actual transitions work great. Really powerful API.
• Problems: a) first transition is triggered right away. b) weird validations to display content because animating state and actual state are out of sync.
With that I'm not trying to bash the author, of course, actually I had almost the exact same issues. Here I'm just pointing out a few ways in which I think the current API can be misused. There are solutions for those problems, yes, but I don't think they are that easy to figure out right now.
So after dealing with some animations, I spotted a pattern with my implementations. Basically I had:
• a class with the state. Same as in Jetsurvey app, which I used as example.
• within that state, hold a current
and animatingTo
states. They work as the source of truth for the transition.
That looked like the ideal solution for some of my transitions (not all of course, some work just fine without extra classes holding the state). Given that a lot of the logic was reused, I created a base implementation instead.
Now, my question is: is this the correct approach? I really don't want to reinvent the wheel, or complicate things with unnecessary logic.kclerc
09/22/2020, 3:10 PMFill
OR Stroke
styles.
In DrawScope’s drawPath
method, documentation says :
Whether this shape is
* filled or stroked (or both) is controlled by [DrawStyle]
What is the appropriate way to do the “both” scenario ?
We could draw the path twice with two different DrawStyles but is there a cleaner solution to do that ?Henning B
09/22/2020, 4:11 PMBrian Beale
09/22/2020, 4:43 PMDaniele B
09/22/2020, 4:58 PMNat Strangerweather
09/22/2020, 5:32 PM@Composable
fun BoxCards(color: Color, gradientColor: Color, text: String, size: Dp) {
val (selected, onSelected) = remember { mutableStateOf(false) }
val tlRadius = animate(if (selected) 48.dp else 20.dp)
val radius = animate(if (selected) 0.dp else 20.dp)
val boxModifier = Modifier
.size(size)
.weight(1f)
.clip(
shape = RoundedCornerShape(
topLeft = tlRadius, topRight = radius,
bottomLeft = radius, bottomRight = tlRadius
)
)
.toggleable(value = selected, onValueChange = onSelected)
.background(
VerticalGradient(
0.0f to color,
0.5f to gradientColor,
1.0f to color,
startY = 0.0f,
endY = with(DensityAmbient.current) { 150.dp.toPx() }
)
)
Box(
boxModifier,
gravity = Center
) {
Text(text = text, color = Color.White)
}
}
I've used a tutorial by one of the Google team for the animation... Is there a simple way of converting my BoxCards into radio button behaviour?caelum19
09/23/2020, 11:08 AMSergey Y.
09/23/2020, 12:12 PMgpaligot
09/23/2020, 12:33 PMRoi Peretz
09/23/2020, 2:20 PMHenning B
09/23/2020, 4:07 PMAjeet Pratap
09/23/2020, 8:24 PMgrandstaish
09/23/2020, 8:59 PMColumn
children?Mohamed Elfiky
09/24/2020, 1:27 AMmodifier.clip(RoundedCornerShape(20.dp).background(Color.White)
and
modifier.background(color = Color.White, shape = RoundedCornerShape(20.dp))
Colton Idle
09/24/2020, 3:34 AMTextField(
value = textState.value,
onValueChange = { textState.value = it },
imeAction = ImeAction.Done,
onImeActionPerformed = { imeAction: ImeAction, softwareKeyboardController: SoftwareKeyboardController? ->
Toast.makeText(ContextAmbient.current, "asdf", Toast.LENGTH_SHORT).show()
}
)
Mohamed Elfiky
09/24/2020, 3:39 AMconsumeScrollDelta
lambda in ScrollableController
receives the delta in dp
now? or i am doing something wrong 😄bruno.aybar
09/24/2020, 5:16 AMDirectionalAlignment
is a private class? Being able to create an alignment with custom vertical and horizontal bias could be really useful. In my case I need to move a component around, and this seemed like the easiest way:
@Composable
fun Sample {
val offset = animatedFloat(initVal = ...)
onActive { offset.animateTo(...) }
Stack {
SomethingThatMoves(Modifier.align(DirectionalAlignment(offset.value,offset.value)))
}
}
Given that it's private, I just copy & pasted the class, and worked perfectly. Is there another easy way to accomplish that?Quentin Dommerc
09/24/2020, 12:44 PMJulius Marozas
09/24/2020, 2:12 PMJulius Marozas
09/24/2020, 2:12 PM