Utkarsh Tiwari
10/29/2021, 9:48 AMolonho
10/29/2021, 11:07 AMArpit Shukla
10/29/2021, 1:44 PMPiotr Krzemiński
10/29/2021, 2:09 PMDiego
10/29/2021, 3:14 PMLazyColumn
if we can do the same thing with a vertical scrollable Column
? Is it because performance-wise the LazyColumn is better? 🤔Sergey Y.
10/29/2021, 3:32 PMAnimatedContent
transition to complete? Is there a callback for this?
Well, I found that the AnimatedVisibilityScope
has the transition
attribute with the isRunning
property. Is this the correct way to use it?
I want to fire my action after the animation ends.
Thanks.Brian G
10/29/2021, 5:19 PMBox(Modifier.fillMaxSize(), contentAlignment = Alignment.TopStart) {
Box(Modifier.fillMaxWidth().background(Color.Black).requiredHeight(1200.dp), contentAlignment = Alignment.TopStart) {
Text("top", Modifier.requiredHeight(300.dp).background(Color.Red).align(Alignment.TopCenter))
Text("middle", Modifier.requiredHeight(300.dp).background(Color.Green).align(Alignment.Center))
Text("bottom", Modifier.requiredHeight(300.dp).background(Color.Blue).align(Alignment.BottomCenter))
}
}
Marcello Galhardo
10/29/2021, 5:40 PMMutableState
and State
inside a ViewModel
? For example, why would someone choose a MutableStateFlow
in a ViewModel
and do a collectAsState
instead of simple using a MutableState
at first place? 🤔Alexander Suraphel
10/29/2021, 6:10 PMModifier.fillParentMaxWidth()
what am I missing?Chris Johnson
10/29/2021, 8:15 PMlet
is broken going from version 1.0.1 of compose to alpha01? Code in thread.Mehdi Haghgoo
10/29/2021, 8:44 PMFelix Schütz
10/30/2021, 12:44 AMMiguel Vargas
10/30/2021, 1:46 AMfun StateFlow<T>.collectAsState()
without initial value so I don’t have to come up with some empty object while the ui waits for the ViewModel to figure out what should be drawn. But when I want to log each emission it breaks because Flow<T>.collectAsState
does require an initial.
class ViewModel {
val myStateFlow = _myStateFLow
.onEach { logger.i("check $it out!") }
// onEach casts it to Flow, not a StateFlow any more :(
}
Any ideas for a workaround?lhwdev
10/30/2021, 2:22 AM.minimumTouchTargetSize()
was added to Surface.
Button should extend to minimum touch target size, but it seems only the Surface (in the Button.kt
) extended, Row didn't extended. Is this expected behavior?Florian
10/30/2021, 11:01 AMonStart
when using compose? Do I create a property and initialize it in setContent
? In the past I would've used by viewModels()
.
Or should I use something like this?Arsen
10/30/2021, 10:56 PMval catsState = mutableStateListOf<Cat>()
val sortState = mutableStateOf("ASC") // [ASC, DESC]
// ------ Worker Thread ---------
val snapshot = Snapshot.takeMutableSnapshot()
val sort = sortState.value
val cats = fetchCoolCatsFromNetwork(sort)
snapshot.enter {
catsState.clear()
catsState.addAll(cats)
Snapshot.lockOnGlobalSnapshot { // Does it possible?
val sortOfActualGlobalSnapshot = sortState.value
if(sortOfActualGlobalSnapshot == sort) {
snapshot.apply()
} else {
snapshot.dispose()
}
}
}
P.S. State hoisted to ViewModelenighma
10/31/2021, 1:59 AMhttps://www.youtube.com/watch?v=15Q7xqxBGG0&t=1s▾
Arpit Shukla
10/31/2021, 9:32 AMAdib Faramarzi
10/31/2021, 1:37 PMLazyColumn
’s items to appear with an animation?Cicero
10/31/2021, 4:13 PMmertceyhan
10/31/2021, 5:12 PMVivek Sharma
10/31/2021, 7:16 PMCanvas
and then rotating
it by angle 45f
, is there a way to get that end Offset
till the line is rotated
How can I get/access this Offset (?,?)
?Alex C
11/01/2021, 4:18 AMval image = animatedVectorResource(id = R.drawable.animated_vector)
val atEnd by remember { mutableStateOf(false) }
Icon(
painter = image.painterFor(atEnd = atEnd),
contentDescription = null // decorative element
)
Ch8n
11/01/2021, 8:19 AMModalBottomSheetLayout
when the unfocused/background region is pressed?Colton Idle
11/01/2021, 9:47 AMbackgroundColor
of BottomNavigation
to Color.Red, it turns Red.
If I set backgroundColor
of BottomNavigation
to Color.Black, it turns Grey.
Why and how do I make it black?Tolriq
11/01/2021, 9:57 AMnlindberg
11/01/2021, 10:20 AMAnimatedVisibility(
visible = viewModel.show,
enter = slideInVertically() + fadeIn(initialAlpha = 0f),
exit = slideOutVertically() + fadeOut()
) {
Box(
modifier = Modifier
.shadow(elevation = 5.dp, shape = TooltipShape(0.7f), clip = false)
.background(color = Color.White, shape = TooltipShape())
.padding(horizontal = 12.dp, vertical = 14.dp)
) {
content()
}
Arpit Shukla
11/01/2021, 11:06 AMlesincs
11/01/2021, 12:05 PMbottomBar
using a wrapContentHeight
Modifier.Michal Klimczak
11/01/2021, 3:31 PMMichal Klimczak
11/01/2021, 3:31 PMdata class SearchSuggestions(
override val searchPhrase: String,
val suggestions: List<String>
) : ShopScreenState(), HasSearchPhrase
data class SearchRecents(
override val searchPhrase: String,
val recentSearches: List<String>
) : ShopScreenState(), HasSearchPhrase
Now I want a nice crossfade when SearchSuggestions
changes into SearchRecents
and vice versa. But don't want the crossfade to "blink" every time e.g. SearchRecents
changes to a different SearchRecents
I don't want to get rid of data class magic, too, it's useful in other places. Its equals should not change.
What I want is to compare different states myself and only then crossfade one state to another, but still be able to use the whole state internally, e.g. like this
Crossfade(state, diff = { previousState, newState -> previousState::class != newState::class }){
when(it)... //`it` should still be ShopScreenState, so that it's smartcasted and preserved across animation
}
Doris Liu
11/01/2021, 5:37 PMcontentKey
in AnimatedContent, where the contentKey
can be defined for each target, and is being used for diffing. You can use that for your use cases. The support in crossfade is coming, tracked here: https://issuetracker.google.com/197907070
In the meantime, I'd encourage you to try out contentKey
and let us know if you have any other feature requests. See https://developer.android.com/reference/kotlin/androidx/compose/animation/package-summary#(androidx.compose.animation[…].Function1,kotlin.Function2)Michal Klimczak
11/01/2021, 5:55 PMDoris Liu
11/01/2021, 5:57 PMThomas
11/02/2021, 8:10 PMcontentKey
and it should do exactly what I want. Thanks for adding it! However, it looks like you missed a function. Is there a reason contentKey
was not added here? https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]ent.kt;l=119-129;drc=4b91a7fe67a0a791829b42dbccb4e80f7beaaf74Doris Liu
11/02/2021, 8:13 PMAnimatedContent
(i.e. non-extension fun version) intentionally to keep that version simple and therefore easy to learn.