Karthick
02/18/2021, 9:21 AMAppBar(centerTitle: true, title: Text("Title"))
Kshitij Patil
02/18/2021, 11:23 AMModifier.padding()
.preferredSize()
.apply {
if(<some condition>) {
this.then(Modifier.clickable { })
}
}
but didn’t workalorma
02/18/2021, 11:27 AM* What went wrong:
lateinit property variantName has not been initialized
When trying to build my project form command line
Config:
com.android.tools.build:gradle:7.0.0-alpha06
6.8.2-all.zip
compose alpha12
David Edwards
02/18/2021, 12:19 PMSpinner
yet?Timo Drick
02/18/2021, 1:27 PMBradleycorn
02/18/2021, 1:54 PMGeert
02/18/2021, 2:16 PMLukas K-G
02/18/2021, 2:51 PMSimone Summo
02/18/2021, 3:35 PMquery
and an onValueChange: (String?) -> Unit
. The idea is that when I have the onValueChange
with the string as null the UI is different and the TextField is empty, but I get an error when I call my onValueChange inside the clickable of the close icon.
The error I get:
java.lang.AssertionError: org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl@63ae5d17: No such type argument slot: 1
Alexander Karkossa
02/18/2021, 3:50 PMval state: StateFlow<HomeViewState>
get() = _state
init {
viewModelScope.launch {
combine(
...
}.collect {
_state.value = it
}
}
}
Why don't use return value of the combine method directly to the state variable?
val state = combine(
...
)
Can someone explain the benefits of viewModelScope.launch -> collect in the init?escodro
02/18/2021, 5:02 PMsealed classes
via StateFlow
).
How could I handle the state changes?
1. Combine both states (with .combine
) and create a third “ViewState” mixing and matching the two states.
2. Observe both individually and let my function recompose when they change
3. Another better approach?
The first ViewModel has three states: EmptyList, LoadedList, Error and the second one has two: DataLoaded and Error.
Thanks and advance! 🎉alorma
02/18/2021, 6:14 PMMaterialTheme
, to obtain the light
or dark
version of a MaterialTheme?julioromano
02/18/2021, 6:37 PMnavigation-compose
?
Previously I was using NavDeepLinkBuilder
but I can’t seem to get it work with compose.romainguy
02/18/2021, 6:40 PMZach Klippenstein (he/him) [MOD]
02/18/2021, 6:51 PMJakub Ledwon
02/18/2021, 7:13 PMAnimatable
instead of AnimatedFloatModel
, I was using fling
and as Animatable
has no fling method I've switched to using animteDecay
, what I need is some way to use both decay
and adjustTarget
as I did with AnimatedFloatModel
how can I achieve it now?Colton Idle
02/18/2021, 8:38 PMSergey Y.
02/18/2021, 10:41 PMMerged
.
Does this tell us we will have multithreaded composition soon? ☺️Gabriel
02/18/2021, 11:28 PMCash Hsiao
02/19/2021, 10:02 AMclass TestDialogFragment : DialogFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
) = ComposeView(requireContext()).apply {
setContent {
Surface {
TestDialogLayout()
}
}
}
}
It's all normal with the deploy Preview
@Preview
@Compose
fun PreviewTestDialog() {
TestDialogLayout()
}
But when I navigate from other fragment like:
TestDialogFragment().show(childFragmentManager, "Test")
or navigation way:
findNavController().navigate(MainFragmentDirections.actionToTestDialog())
Both calls gave me this crash log:
java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from DecorView@bec849f[MainActivity]
at androidx.compose.ui.platform.WindowRecomposerKt.createLifecycleAwareViewTreeRecomposer(WindowRecomposer.kt:231)
at androidx.compose.ui.platform.WindowRecomposerKt.access$createLifecycleAwareViewTreeRecomposer(WindowRecomposer.kt:1)
at androidx.compose.ui.platform.WindowRecomposerFactory$Companion$LifecycleAware$1.createRecomposer(WindowRecomposer.kt:115)
at androidx.compose.ui.platform.WindowRecomposerPolicy.createAndInstallWindowRecomposer$ui_release(WindowRecomposer.kt:168)
at androidx.compose.ui.platform.WindowRecomposerKt.getWindowRecomposer(WindowRecomposer.kt:216)
at androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated(ComposeView.kt:184)
at androidx.compose.ui.platform.AbstractComposeView.onAttachedToWindow(ComposeView.kt:215)
at android.view.View.dispatchAttachedToWindow(View.java:19553)
I'm not sure what happened during the alpha10 to alpha12... anyone has idea?Se7eN
02/19/2021, 3:08 PMImageBitmap
? If yes, how do I draw text on the bitmap since there's no drawText
for Canvas(bitmap)
Shakil Karim
02/19/2021, 4:40 PMLilly
02/19/2021, 7:49 PMrememberSaveable
but it doesn't get restored, instead it jumps always into the init method of rememberSaveable
. What am I doing wrong?
val navigator: Navigator<T> by rememberSaveable(
stateSaver = Navigator.saver(backDispatcher = backDispatcher),
key = "State
) {
println("initial")
mutableStateOf(
Navigator(
initialConfiguration = initialConfiguration,
backDispatcher = backDispatcher
)
)
}
fun <T : Parcelable> saver(
backDispatcher: OnBackPressedDispatcher
) = listSaver<Navigator<T>, T>(
save = { navigator -> navigator.backStack.toList() },
restore = { backStack -> Navigator(backStack, backDispatcher) }
)
I noticed that rememberSaveable
is called internally multiple times, first time with my provided key and the other times it jumps into the else branch and generates a hash. Is this a bug?
rememberSaveable:
val finalKey = if (!key.isNullOrEmpty()) {
key
} else {
currentCompositeKeyHash().toString()
}
Tristan
02/20/2021, 3:32 AMKshitij Patil
02/20/2021, 6:15 AMSubComposeLayout
. The compose sample has given sort of Scaffold of it and I’m not able not understand its usage from it. The layout I’m trying to build is as follows: my approach was to use Text
as “mainContent” and pass its dimensions to a Canvas
“dependentContent” to draw those accompanying lines. Any other suggestions/approaches are welcomeMehdi Haghgoo
02/20/2021, 7:56 AMMarcello Galhardo
02/20/2021, 11:44 AMOrhan Tozan
02/20/2021, 1:23 PMSamir Basnet
02/20/2021, 4:10 PMSamir Basnet
02/20/2021, 4:10 PMDenis
02/20/2021, 4:11 PMSamir Basnet
02/20/2021, 4:13 PM