Slackbot
09/09/2022, 4:32 AMZoltan Demant
09/09/2022, 9:36 AMLaunchedEffect(list.size){ scrollToTop() }
in order to scroll my LazyColumn
to the top whenever the list size changes. This works great, but it also scrolls the list to the top whenever I navigate back to it since the LaunchedEffect is restarted. I could work around this with rememberSaveable
, but that doesnt seem ideal. Is there another better approach?AmrJyniat
09/09/2022, 10:47 AMAnimatedVisibility
disable/ignore the padding of its children?
AnimatedVisibility(visible = isExpanded) {
Divider(
modifier = Modifier.padding(bottom = 12.dp).fillMaxWidth(),
color = Gray200,
thickness = 2.dp
)
OutlinedButton(
modifier = Modifier.padding(top = 12.dp),
onClick = {}
){}
}
The padding of both divider and button has no effect when wrapping them within AV, but when I comment AV out the padding works well, am I missing anything?Colton Idle
09/09/2022, 12:46 PMLaunchedEffect(viewModel.screenState.something != null)
Should it instead be LaunchedEffect(viewModel.screenState.something
and then do the null check inside (or outside of) the LE?Stylianos Gakis
09/09/2022, 2:46 PMSpacer(Modifier)
and see if it still recomposes. If not, then the problem is in the item itself.
From guessing I’d say it should not recompose unless you’re inside the item reading something related to the scroll-state or some other state which changes while scrollingUgnius N.
09/09/2022, 3:17 PMChris Fillmore
09/09/2022, 5:16 PM@Preview
on a device, I get an error of the sort: https://stackoverflow.com/q/68554294Aaron Waller
09/09/2022, 6:51 PMyogaboy
09/10/2022, 6:14 PMrememberDismissState
is missing in M3.
Pls. any example or tutorial? I read the documentation for compose and material3 and I can’t find anything even on github. Thanks a lot 🙏🏻Tariyel Islami
09/10/2022, 7:57 PMandrew
09/11/2022, 4:40 AMChachako
09/11/2022, 6:12 AMLazyColumn
comes from two different APIs. “A-API” is the basis of “B-API” so paging requests complete item data is very slow. The data of the “B-API” is not urgently needed. I hope it can be loaded lazily. Is there any way?yogaboy
09/11/2022, 6:07 PMmgrazianodecastro
09/12/2022, 12:50 AMmgrazianodecastro
09/12/2022, 4:09 AMZoltan Demant
09/12/2022, 9:55 AMAnimatedContent
. Theres almost always a slight stutter when using it to transition to a new screen; and its almost always exclusive to the first time the screen is shown - from there and on the transition is smooth for as long as the app is running. Using R8, baseline profiles, etc. Is this a known issue; or am I simply doing something wrong? Ill attach a simple code example in the thread. 🧵Zoltan Demant
09/12/2022, 10:12 AMTgo1014
09/12/2022, 10:33 AMAsad Mukhtar
09/12/2022, 10:39 AMprivate val _flightList = MutableLiveData<List<FlightListingUiModel>>()
val flightsList: LiveData<List<FlightListingUiModel>> = _flightList
Isaac Udy
09/12/2022, 10:59 AMremember
state alive between calls to movableContentOf
?
I currently have a situation where I am doing something like this:
val moveable = remember { moveableState { DrawAnItem() } }
if(visible) moveable.invoke()
The problem is that when “visible” gets toggled, all `remember`ed state inside DrawAnItem
is reset.
However, if I do this:
val moveable = remember { moveableState { DrawAnItem() } }
if(visible) moveable.invoke()
else {
Box(modifier = Modifier.alpha(0f)) {
moveable.invoke()
}
}
the `remember`ed items are properly remembered in between calls to “visible”. This obviously isn’t a very good solution, but I’m trying to figure out how to keep a composable “alive” when I know that I’m going to render it again in the not-too-distant future.Asad Mukhtar
09/12/2022, 12:25 PMAdrian Landborn
09/12/2022, 1:29 PMUli Bubenheimer
09/12/2022, 7:35 PMcurrentCompositeKeyHash
aka currentComposer.compoundKeyHash
well-defined? rememberSaveable()
uses it for save keys, but if I add something like key(objectWithDefaultHashKey)
to my Compose hierarchy then I assume the save key will be different before and after process death, and whatever I saved would not be restored, right? My particular use case has key(enumValue)
, which I assume would also have different hash values before and after process death, based on what Enum.hashCode()
does.
Would I be in the clear then, as far as rememberSaveable()
goes, if I used something like key(enumValue.myStringLabel)
instead?
The reason for my question is this comment from a Googler: https://issuetracker.google.com/issues/152014032#comment4Chris Fillmore
09/12/2022, 7:49 PM@Preview
working in a multi module project. Has anyone had trouble doing this?KoskiA
09/12/2022, 8:18 PMLazyColumn
at a specific scroll amount, instead keeping an item/key visible, when inserting items? (i.e. sticking to the top of the list when inserting at zero)Lilly
09/12/2022, 11:02 PMLazyColumn
? Currently the state is applied to all items. Example code:
@Composable
private fun ScannerList(
items: List<DiscoveredBluetoothDevice>,
connectionState: ConnectionState, // StateFlow in view model
) { ...
private fun ScannerListItem(
connectionState: ConnectionState,
...
) {
ListItem(
trailing = {
Button(onClick = { // trigger change of connectionState in view model })
val iconColor: Color = when (connectionState) { ConnectionState.Connected -> Green600 ... }
}
)
}
Do I have to narrow down List<DiscoveredBluetoothDevice>
so I get sth like List<DiscoveredBluetoothDeviceItem>
?Tariyel Islami
09/13/2022, 12:28 AMColton Idle
09/13/2022, 3:16 AMOliver.O
09/13/2022, 10:48 AMsteelahhh
09/13/2022, 1:39 PMe: Multiple values are not allowed for plugin option androidx.compose.compiler.plugins.kotlin:metricsDestination
when I try to run composable metrics
Don't see any other obvious source where this value would come from aside from my own code. Any ways to debug this properly?steelahhh
09/13/2022, 1:39 PMe: Multiple values are not allowed for plugin option androidx.compose.compiler.plugins.kotlin:metricsDestination
when I try to run composable metrics
Don't see any other obvious source where this value would come from aside from my own code. Any ways to debug this properly?ephemient
09/13/2022, 1:46 PMsteelahhh
09/13/2022, 1:53 PMephemient
09/13/2022, 2:04 PM:
or any other special characters in it? or are you somehow applying other command-line arg additions in some modules?steelahhh
09/13/2022, 2:08 PMkapt
or molecule plugin solves the issue and metrics run just fine
Time to give anvil a go, I guess 😛arrot-upside-down: