Colton Idle
04/10/2022, 4:20 PMderivedStateOf
often but does this seem like a good use case? Bonus: Why can't I use by
and need to use =
when using derivedStateOf
?
class SignUpScreenViewState {
var email by mutableStateOf("")
var password by mutableStateOf("")
var acceptTerms by mutableStateOf(false)
var canMakeSignUpCall = derivedStateOf { email.isNotEmpty() && password.isNotEmpty() && acceptTerms }
}
Christoph Wiesner
04/11/2022, 7:35 AMButton
applies some inset even though elevation
+ contentPadding
is set to zero.
Button(
modifier = modifier
.size(46.dp)
.padding(0.dp).background(Color.Green),
elevation = ButtonDefaults.buttonElevation(
// all zero
),
shape = RoundedCornerShape(13.dp),
contentPadding = PaddingValues(0.dp)
) {
Icon(
painter = iconPainter,
contentDescription = contentDescription,
modifier = Modifier.size(20.dp)
)
}
gives meMichał Diner
04/11/2022, 8:59 AMjava.lang.IllegalArgumentException
No destination with route "A" is on the NavController's back stack. The current destination is a route ="B"
while trying to access public fun getBackStackEntry(route: String): NavBackStackEntry
to scope our sharedViewModel.
composable("A"){
ScreenA(hiltViewModel(it)
}
composable("B){
val parentNavBackStack = remember { navController.getBackStackEntry("A") }
ScreenB (hiltViewModel(parentNavBackStackEntry))
}
It literally feels like we covered all the necessary steps and I’m totally clueless about what else I can do to fix this. Both screens are inside the same navGraph and usually work without any issues.
Is this an issue with the navigation component?
Crashes happen on the following devices:
1. Huawei Mate 20 lite Android 10
2. Realme 7 Pro Android 11
Lilly
04/11/2022, 10:46 AMColumn
?zalewski.se
04/11/2022, 3:07 PMAnimatedContent
how can I provide ContentTransform
to handle a case where I don’t want any animation?Nikolas Alvelo
04/11/2022, 4:14 PMdrawArc
that has different colors along the arc based on the arc’s sweep angle? We can get most of the way there with sweepGradient but ideally we wouldn't have the actual gradients and just solid color transitions between arc segmentsJoseph Hawkes-Cates
04/11/2022, 6:15 PMMehdi Haghgoo
04/11/2022, 6:40 PMColton Idle
04/11/2022, 9:40 PMMyTextField(
text = vm.state.email,
onTextChange = vm::emailChange,
...
}
but then emailChange(text: String)
basically does nothing except for setting the value. Better off just doing
MyTextField(
text = vm.state.email,
onTextChange = {vm.state.email = it},
I've always "thought" that all logic that can be moved up to a VM should be moved out of the UI layer, but after reading the arch docs im kinda convinced that whether or not i put stuff in a composable or a VM that's both the UI layer, and it basically "doesn't matter" where I put this stuff. Anyway. Thoughts?Ryan Simon
04/12/2022, 3:40 AMAnastasia Rozovskaya
04/12/2022, 8:55 AMExpandedDropdownMenuDefaults.TrailingIcon
. Feel free to share your thoughts.Christoph Wiesner
04/12/2022, 9:46 AMOutlinedTextField
where i want to display a different border modifier when it’s focused.
when chaining modifiers I get
IllegalStateException: Compose Runtime internal error. Unexpected or incorrect use of the Compose internal runtime API (Use active SlotWriter to determine anchor location instead)(code in comment)
dbaelz
04/12/2022, 10:18 AMjulioromano
04/12/2022, 12:53 PMcompose-compiler:1.2.0-dev-k1.6.20-61e81dadb1c
from https://androidx.dev/storage/compose-compiler/repository
It seems to work, does anyone know if there can be any specific issues using such kinds of combos (i.e. compiler 1.2.x + rest of compose 1.1.x )?
Besides being unsupported of course 🙂Filip Wiesner
04/12/2022, 2:33 PMAnimatedNavHost
a lot lately. I've even filed a bug three weeks ago with no response. Does anyone have a workaround for this issue? It seems to me like a huge issue and I didn't see anyone talking about it which seems like it might be only on my end.
Also, is the "official" support for navigation transitions coming anytime soon? The mandatory fade transitions were introduced back in January.Orhan Tozan
04/12/2022, 3:12 PMVenthorus
04/12/2022, 6:05 PMritesh
04/12/2022, 6:49 PMSafe Flow collection in Jetpack Compose
@Composable
fun LocationScreen(locationFlow: Flow<Flow>) {
val lifecycleOwner = LocalLifecycleOwner.current
val locationFlowLifecycleAware = remember(locationFlow, lifecycleOwner) {
locationFlow.flowWithLifecycle(lifecycleOwner.lifecycle, Lifecycle.State.STARTED)
}
val location by locationFlowLifecycleAware.collectAsState()
// Current location, do something with it
}
Do we need it, while collecting states? Isn't Composables
have their own life-cycle? and we need not to worry about how the lifecycle of host it's contained in, while collecting flows?Dan Yang
04/12/2022, 7:32 PMassets/dexopt/baseline.prof
However, I've done both of those and can't find assets/dexopt/baseline.prof
when I profile/debug the apk in android studio.Yacov Rosenberg
04/12/2022, 7:40 PMfun create (lifecycleOwner: LifecycleOwner, view: View) {
val toast = Toast(context)
val toastCustomView = ToastCustomView(
context
)
toast.view = toastCustomView
toast.show()
}
Any help?
zalewski.se
04/12/2022, 8:13 PMmartmists
04/12/2022, 9:50 PMjames
04/12/2022, 11:24 PMwindowSoftInputMode="adjustResize"
Once adjustResize
is enabled, the ModalBottomSheet re-animates into the screen from the bottom during the keyboard close process, despite the fact the modal was already on screen in the Expanded state.
Further, while creating a video to show this bug I discovered that the layout does not obey the Animation Scale from Developer Settings (which was introduced in 1.2.0-alpha05), whereas other Compose components do in fact obey those settings.
Wanted to check if anyone else knows about this or if it has already been filed on the issue tracker, before I file an issue myself.Saurabh Khare
04/13/2022, 1:09 AMJames Black
04/13/2022, 2:47 AMenum class ClothingTypes(val clothingLabel:String) {
BLAZER("blazer"),
BLOUSE("blouse"),
BODY("body");
companion object {
fun getNumberOfItems() = values().size
}
}
And this is my code, but I am not certain why it doesn't remember the state for each one. You can see the code under androidApp in https://github.com/jblack975/MyOutfitPicker/tree/initial_ui
var selectedIndex by remember { mutableStateOf(MutableList(ClothingTypes.getNumberOfItems()) { 0 }) }
val checkedState = remember { mutableStateOf(MutableList(ClothingTypes.getNumberOfItems()) { false }) }
Column {
DropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false },
modifier = Modifier.background(Color.LightGray)
) {
ClothingTypes.values().forEachIndexed { index, s ->
DropdownMenuItem(onClick = {
selectedIndex[index] = index
expanded = true
}) {
Switch(
checked = checkedState.value[index],
onCheckedChange = { checkedState.value[index] = it }
)
Text(text = s.clothingLabel)
}
}
}
Text(text = "outfit view", style = MaterialTheme.typography.h6)
}
ritesh
04/13/2022, 3:21 AMFocusManager.moveFocus(FocusDirection.Down)
doesn't scroll to the nearest focusable descendent, if i am calling it from the last visible node on the screen and next focusable node is out of the screen.
Is this an expected behavior and needs some extra handling or it's a known bug?
Here, my all focusable nodes are text-fields.Android75
04/13/2022, 6:11 AMjava.lang.IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
this is shape.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="<http://schemas.android.com/apk/res/android>" android:shape="oval">
<solid android:color="#F44336"/>
</shape>
and code.
Image(
imageVector = ImageVector.vectorResource(
id = R.drawable.ball
),
contentDescription = null
)
jasu
04/13/2022, 7:27 AMritesh
04/13/2022, 8:27 AMval lits1 = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
val list2 = listOf("one", "two", "three", "four", "five")
LazyRow {
// first
itemsIndexed(items = lits1) { _, item ->
Text(text = "$item")
}
// second
itemsIndexed(items = list2) { _, item ->
Text(text = item, modifier = Modifier.background(Green))
}
}
Instead of giving background to each items in list2
, is it possible to give the whole list items as a background in second
itemsIndexed
. I couldn't think of any other solution than this.nuhkoca
04/13/2022, 10:04 AMnuhkoca
04/13/2022, 10:04 AMCsaba Szugyiczki
04/13/2022, 10:28 AMRow
If yes, the Row has a verticalAlignment
parameter to which you can pass Alignment.CenterVertically
Chris Sinco [G]
04/13/2022, 10:36 AMnuhkoca
04/13/2022, 11:27 AMtitle
and description
inside a Column
, the description
doesn’t respect to the `title'`s space and overlaps it. Do you know why?Layout(
modifier = Modifier
.padding(horizontal = TRTheme.spacing.default)
.padding(top = TRTheme.spacing.default, bottom = TRTheme.spacing.single),
content = {
...
}) { measurables, constraints ->
...
maxHeight
, used placeables’ height and it is fixed 🙂