Colton Idle
01/13/2021, 3:49 AMSlackbot
01/13/2021, 5:14 AMJohn O'Reilly
01/13/2021, 5:58 PMGeometryReader
for getting the dimensions of the screen/window?tcracknell
01/13/2021, 6:55 PMjuliocbcotta
01/13/2021, 8:29 PMallan.conda
01/14/2021, 10:13 AM@Deprecated(
"offsetPx was deprecated. Please use offset with lambda parameters instead.",
ReplaceWith(
"offset({x.value}, {y.value})",
"androidx.compose.foundation.layout.offset",
"kotlin.math.roundToInt()"
)
)
I can’t find this replacement function 🤔allan.conda
01/14/2021, 11:07 AM@Composable properties should be declared with the @Composable annotation on the getter, and not the property itself.But it won’t let me do it. What’s the right way?
Kai Zhu
01/14/2021, 11:45 AMNote: Modifiers can play a similar role to XML attributes in the View system, but the type safety of scope-specific modifiers helps you to discover and understand what is available and applicable to a certain layout. Compare this with XML layouts where it was not always clear if a layout attribute was applicable to a given View.This is copied from the Jetpack Compose Codelab "Layouts in Jetpack Compose". But it's not true as far as I know, because xml layouts does have the ability to tell if a layout attribute is applicable to a given View. Am I wrong or have I misunderstood what the doc says? Source: https://developer.android.com/codelabs/jetpack-compose-layouts?continue=https%3A%2F%2Fd[…]developer.android.com%2Fcodelabs%2Fjetpack-compose-layouts
allan.conda
01/14/2021, 1:00 PMallan.conda
01/14/2021, 1:37 PMjaqxues
01/14/2021, 2:02 PManimate
has been deprecated and should now be animateAsState
however, there are 2 different top level functions for T
, and one for Color
androidx.compose.animation.animateAsState
(Color)
androidx.compose.animation.core.animateAsState
(T)
Is that intended?dimsuz
01/14/2021, 5:36 PMif (isJobRunning) Box() else CircularIndicator()
but that makes progress bar jump.
In old View system I would wrap them both in FrameLayout and have the indicator use layout_gravity=center
while setting box.visibility = INVISIBLE
.
What path should I take in Compose?Vsevolod Ganin
01/14/2021, 5:50 PMonSizeChanged
reports size without padding?
@Preview
@Composable
fun Test() {
val density = AmbientDensity.current
Box(
modifier = Modifier
.padding(with(density) { 50.toDp() })
.size(with(density) { 50.toDp() })
.background(Color.Red)
.onSizeChanged { println(it) }
)
}
I expect this to print 150 x 150
, but get 50 x 50
instead.alorma
01/14/2021, 6:29 PMalorma
01/14/2021, 7:13 PMjava.lang.NoSuchMethodError: 'androidx.compose.runtime.SlotTable androidx.compose.runtime.Composer.getSlotTable()' at androidx.ui.tooling.InspectableKt.Inspectable(Inspectable.kt:63) at androidx.ui.tooling.preview.ComposeViewAdapter$WrapPreview$1.invoke(ComposeViewAdapter.kt:357) at androidx.ui.tooling.preview.ComposeViewAdapter$WrapPreview$1.invoke(ComposeViewAdapter.kt:-1) at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:146) at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:-1) at androidx.compose.runtime.AmbientKt.Providers(Ambient.kt:188) at androidx.ui.tooling.preview.ComposeViewAdapter.WrapPreview(ComposeViewAdapter.kt:356) at androidx.ui.tooling.preview.ComposeViewAdapter.access$WrapPreview(ComposeViewAdapter.kt:-1) at androidx.ui.tooling.preview.ComposeViewAdapter$init$1.invoke(ComposeViewAdapter.kt:397) at androidx.ui.tooling.preview.ComposeViewAdapter$init$1.invoke(ComposeViewAdapter.kt:-1) at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:146) at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:-1) at androidx.compose.runtime.AmbientKt.Providers(Ambient.kt:188) at androidx.compose.ui.platform.AmbientsKt.ProvideCommonAmbients(Ambients.kt:274) at
Tony Kazanjian
01/14/2021, 7:28 PMspencer
01/14/2021, 9:54 PMNat Strangerweather
01/14/2021, 10:18 PMjulioromano
01/15/2021, 11:08 AMallan.conda
01/15/2021, 11:43 AMconfirmStateChange
callback but seems it is only invoked when dismissed with a swipe gesture. A gentle drag, invoking drawerState.close
, or clicking outside the drawer doesn’t trigger this callback.
Makes me think that callback is broken if it’s only valid for a swipe gesture 🤔grandstaish
01/15/2021, 1:32 PMAli Albaali
01/15/2021, 3:02 PM@Composable
fun SomeComposable(content : @Composable (() -> Unit)? = null) {}
@Composable
fun OtherComposable(content : @Composable () -> Unit = emptyContent()) {}
audriusk
01/15/2021, 5:55 PM@Composable
fun ComposableA() {
val stateA by savedInstanceState { "id" }
ComposableB(stateA) // <-- How to drop all subtree state on stateA change?
}
@Composable
fun ComposableB(state: String) {
val stateB by savedInstanceState { "stateB" }
// deep nested structure with more states
}
I want ComposebleB
to be composed with fresh child states when stateA
changes. What would be right way to achieve such behavior?Bradleycorn
01/15/2021, 6:35 PMMikołaj Kąkol
01/15/2021, 7:49 PMtabA
is visible tabB
is not in composition tree.
My problem is that when I switch between them state is not remembered, for example scroll state. How can I tell to compose to remember this discarded tab, that it can be needed soon?
(sample code in thread)Vitor Prado
01/15/2021, 7:50 PMGeert
01/15/2021, 9:25 PMMia Clapham
01/15/2021, 10:06 PMColton Idle
01/15/2021, 10:15 PMQracle
01/16/2021, 6:54 AMQracle
01/16/2021, 6:54 AMSiyamed
01/16/2021, 9:29 PMQracle
01/16/2021, 9:44 PM