alorma
11/03/2020, 8:36 AMdai
11/03/2020, 9:12 AMMao
11/03/2020, 9:17 AMambientOf
and staticAmbientOf
. Since staticAmbientOf
will force all children doing recomposition, seems like ambientOf
is more efficient. But after search the source code, I found that there are more occurrences of staticAmbientOf
. I understand that most of them are rarely changed and the comment of staticAmbientOf
says:
A static ambient should be only be used when the value provided is highly unlikely to change.
But why not just using staticOf
? Are there any circumstances that we must do all children recomposition?
I would be very happy if there were some guides to told me how to choose between ambientOf
and staticAmbientOf
.
Thanks!Stefano Rodriguez
11/03/2020, 9:18 AMWithConstraints
composable and a drawLayer
modifier with scaleX and scaleY, but it was much more cumbersome to achieve my expected result
https://api.flutter.dev/flutter/widgets/FittedBox-class.htmldagomni
11/03/2020, 11:28 AMArun
11/03/2020, 11:53 AMMohammad Sianaki
11/03/2020, 2:42 PMRodri Represa
11/03/2020, 2:54 PMsubashz
11/03/2020, 2:55 PMandroidx.compose.material.samples.MenuSample
jaqxues
11/03/2020, 3:27 PMcomposable
destination to a NavHost at runtime. How do I do so without reloading the current Composable that is seen on the screen? By having a mutable state that is read from NavHost
, the entire screen is refreshed (and animations look weird, state is reset etc)Stefano Rodriguez
11/03/2020, 3:53 PMrender
method
interface TestScreen<State: Any> {
val name: String
val initialState: State
@Composable
fun render(state: State, setState: (State) -> Unit)
}
Paul Woitaschek
11/03/2020, 4:13 PMAfzal Najam
11/03/2020, 4:36 PMsubashz
11/03/2020, 5:44 PMsubashz
11/03/2020, 6:11 PMFloatingActionButton(
onClick = {
LaunchedTask {
scaffoldState.snackbarHostState.showSnackbar(
"Hello World..",
"",
SnackbarDuration.Short
)
}
}
@Composable invocations can only happen from the context of a @Composable functionGrigorii Yurkov
11/03/2020, 6:35 PMRow
doesn't want to get recomposed even after his child Text
become bigger. Should I recompose it manually? If yes, how can I do it?Gabriel
11/03/2020, 7:48 PMandroidTestImplementation("androidx.ui:ui-test:$COMPOSE_VERSION")
but it won't import anything or even mark it as not being imported, I'm not sure what I'm missingRobert Menke
11/03/2020, 8:13 PMTextField
in alpha06 is that ImeAction.GO
doesn’t seem to be working the same way it was in previous versions.
val focusRequester = FocusRequester()
TextField(
value = text,
onValueChange = viewModel::setEmail,
label = { Text(text = "What's your email address?") },
placeholder = { Text(text = "<mailto:jane.doe@gmail.com|jane.doe@gmail.com>") },
keyboardType = KeyboardType.Email,
modifier = frameFillWidth(60.dp).focusRequester(focusRequester),
backgroundColor = MaterialTheme.colors.background,
imeAction = ImeAction.Go,
onImeActionPerformed = { action, keyboardState ->
submit()
}
)
onActive(callback = {
focusRequester.requestFocus()
})
Gabriel
11/03/2020, 8:43 PMjava.lang.AssertionError: Activity never becomes requested state "[STARTED, CREATED, DESTROYED, RESUMED]" (last lifecycle transition = "PRE_ON_CREATE")
Robert Menke
11/03/2020, 9:17 PMIcon
I’m using the below. Is there anything in the current compose lib that’s equivalent?
@Composable
fun ColorIcon(asset: VectorAsset, modifier: Modifier = Modifier) {
val painter = rememberVectorPainter(asset = asset)
Box(modifier.defaultSizeFor(painter).paint(painter))
}
private fun Modifier.defaultSizeFor(painter: Painter) =
this.then(
if (painter.intrinsicSize == Size.Unspecified || painter.intrinsicSize.isInfinite()) {
DefaultIconSizeModifier
} else {
Modifier
}
)
private fun Size.isInfinite() = width.isInfinite() && height.isInfinite()
// Default icon size, for icons with no intrinsic size information
private val DefaultIconSizeModifier = Modifier.preferredSize(24.dp)
Bryan Herbst
11/03/2020, 9:35 PMwisdom
11/04/2020, 12:05 AMMehdi Haghgoo
11/04/2020, 5:20 AMalorma
11/04/2020, 5:20 AMBackdropScaffold
? I'm curious about what you've added to the backgroundLayerOussama Haff.
11/04/2020, 8:08 AMGabriel
11/04/2020, 8:50 AM@Mock
lateinit var viewModel: ImageListViewModel
...
`when`(viewModel.imageItems).thenReturn(listOf())
but doing this gives me an error:
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object androidx.compose.runtime.State.getValue()' on a null object reference
where imageItems is
var imageItems: List<ImageItem> by mutableStateOf(listOf())
private set
would anyone know what I'm doing wrong?Slackbot
11/04/2020, 10:10 AMPrashant Priyadarshi
11/04/2020, 10:50 AMjaqxues
11/04/2020, 4:03 PMRobert Menke
11/04/2020, 5:10 PMRobert Menke
11/04/2020, 5:10 PMmatvei
11/04/2020, 5:13 PMModalBottomSheet
, it should have the behaviour you wantRobert Menke
11/04/2020, 5:14 PMNipun Rajput
11/05/2020, 8:56 AMmatvei
11/05/2020, 10:13 AMModalBottomSheetLayout
should resize itself when content changes. Let me know if it doesn't work for you.Nipun Rajput
11/05/2020, 10:15 AMmatvei
11/05/2020, 10:59 AMNipun Rajput
11/05/2020, 11:00 AMmatvei
11/05/2020, 11:02 AMNipun Rajput
11/05/2020, 11:03 AM