Paul Woitaschek
02/23/2022, 11:11 PMjasu
02/24/2022, 6:00 AMYoshio Schermer
02/24/2022, 8:08 AM@Preview(theme = MyTheme)
@Composable
fun PreviewComposable(){
Text(text = "foo")
}
Lance Gao
02/24/2022, 8:42 AMText()
but the content alignment looks not good, any solutions? Thanks.
Code:
Text(
text = "NEXT",
fontSize = 150.sp,
fontWeight = FontWeight.Bold
)
Preview:ziv kesten
02/24/2022, 10:00 AMCheryl Bennett
02/24/2022, 10:28 AMZoltan Demant
02/24/2022, 10:30 AMAnimatedContent
(and its variants); if the targetState
changes at all, even if it doesnt result in a new animation running, there will be additional recompositions as a result (I was seeing 2-9, instead of 1). I learned this the hard way, Id normally specify what I wanted to render as the targetState
and use transition.contentKey
to key it correctly; stripping out the stuff not directly related to the animation made an immense difference. Ill share some more details in the thread for anyone interested, I dont think this is a bug, but rather me misunderstanding how it works - hopefully it can save you from doing the same mistake as I did!Johan Reitan
02/24/2022, 10:49 AMLazyColumn
sections as `Card`s like described in this thread? I am trying to implement the following design, where each section could contain 100s of items. This is why I’m hesitant to chuck the whole section inside a Column
, and loose the benefits of LazyColumn
.
A workaround that I’ve used successfully in RecyclerView
earlier, is to use a Card
in each item and modify its corners so that it looks like a whole card when put together. In Compose, however, this workaround produces shadows between every item, as described in the thread I mentioned. That particular issue is marked as Won’t Fix (Infeasible).Aleksandar Aleksiev
02/24/2022, 12:29 PMonTextLayout
but not the TextField
Vaios Tsitsonis
02/24/2022, 2:57 PMImage(
painter = painterResource(id = someId),
contentDescription = null
)
but i get this error: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
. I can load vector drawables so I suppose that I need to load layer-list differently... How is this possible?Nat Strangerweather
02/24/2022, 4:37 PMChris Fillmore
02/24/2022, 4:44 PMpointerInput
dead zones in your UI?
I have some draggable elements that drag fine in some parts of the screen, but stop responding to drag events if I drop them in a particular area of the screen. I assume for now that I have some other UI (perhaps hidden) which may be capturing the touch input. But just reviewing the code, I haven’t spotted the source of the problem.Chris Fillmore
02/24/2022, 5:21 PMpointerInput
to detect dragging, and the area that receives the input doesn’t drag along with the element. That is, say I start with something in the center of the screen, and I drag it to the top-left. I can no longer drag that element by putting my finger on it in the top left and dragging. However, if I put my finger in the center of the screen and drag from there, I can drag the item.Tolriq
02/24/2022, 5:57 PMMarin Tolić
02/24/2022, 7:05 PMModifier.pointerInput()
which still has to make the whole Composable area clickable and then decide when it should treat it as a clickable link on a per section basis. I'm wondering if there is any way in compose to say yup point x=1, y=1
should be treated as a click on the Text
Composable but point x=2, y=2
should be treated as a click on its parent.
Unsure if this is doable, but if it is it will allow me to implement a really clean and easy to use solution. 😄
Thank you!aoriani
02/25/2022, 3:13 AMdata class DialogState(val isShown: Boolean = false, val message: String = "")
@Composable
fun Screen(navController: NavController, viewModel: MyViewModel) {
val dialogState by rememberUpdateState(DialogState)
val scope = rememberCoroutineScope()
Button(onClick = { scope.launch {
when (val result = viewModel.doRequest()) {
is Success -> navController.popBackStack()
is NotFound -> dialogState = DialogState(true, "Not Found")
else -> dialogState = DialogState(true, "error")
}})
if (dialogState.isShown) {
AlertDialog(.......)
}
}
Would this be correct ?Utkarsh Tiwari
02/25/2022, 5:28 AMScrollableTabRow
and HorizontalPager
?Tiago Nunes
02/25/2022, 10:05 AM@Preview
@Composable
fun MenuPreview(
@PreviewParameter(MenuItemPreviewParameterProvider::class) menuItems: List<MenuItem>
) {
MdcTheme {
Menu(menuItems)
}
}
class MenuItemPreviewParameterProvider : PreviewParameterProvider<MenuItem> {
override val values = sequenceOf(
MenuItem("Beer & Other"),
MenuItem("More"),
MenuItem("Shop All Products"),
)
}
I would expect menuItems argument to be a list with the 3 sample valuesZoltan Demant
02/25/2022, 10:09 AMziv kesten
02/25/2022, 12:17 PMNat Strangerweather
02/25/2022, 4:12 PMvar enabled by remember { mutableStateOf(true) }
and var visible by remember { mutableStateOf(true) }
. When I reload the Composable with new data, these variables do not return to their original true
value. Why is that? And how can I make sure they are updated too?Francois Morvillier
02/25/2022, 5:07 PMCard(backgroundColor = MaterialTheme.colorScheme.surface) {
Text(text, color = MaterialTheme.colorScheme.onSurface)
}
Is there a good guide to best practices on the topic?Ankur Gupta
02/25/2022, 5:27 PMShreyas Patil
02/25/2022, 7:06 PMTobias Gronbach
02/26/2022, 1:19 PMbrabo-hi
02/26/2022, 7:56 PMScott Kruse
02/26/2022, 9:37 PMMarcin Wisniowski
02/26/2022, 10:20 PM@Preview(showSystemUi = true)
option shows the status bar overlaid over the content, which is not what's usually wanted. Am I missing something?Mehdi Haghgoo
02/27/2022, 3:59 AMskwalking
02/27/2022, 9:50 AMskwalking
02/27/2022, 9:50 AMColton Idle
02/27/2022, 10:22 AMMichael Paus
02/27/2022, 1:49 PMAdam Powell
02/27/2022, 2:52 PMScott Kruse
02/27/2022, 3:16 PMLandry Norris
02/27/2022, 8:52 PMArkadii Ivanov
02/27/2022, 11:47 PM