AmrJyniat
11/25/2021, 5:04 PMModalBottomSheetLayout
, when swipe it to the bottom to collapse it, it stops on Half Expand state and I need to swipe it again to collapse it totally, any idea?mcpiroman
11/25/2021, 5:13 PMLazyColumn
), but because the tree itself is very complicated and reactive, I would also like to use compose-runtime to manage its nodes.
I.e. I want to use the compose with custom `NodeApplier`to generate nodes of the tree that I then take and display with the standard (in my case desktop)-compose.
Can it be somewhat easily achievable? There is something called sub-composition
, the `Composition`function also takes a parent `CompositionContext`but I don't quite know how to glue that together. I have looked at https://github.com/JakeWharton/mosaic/ but it uses the compose-runtime standalone, while I want it kind of 'nested'.Daniele Segato
11/25/2021, 6:43 PMOutlinedTextField
do you know of any library or snipped of code that port material 2 textfield to material 3? ThanksSteffen Funke
11/25/2021, 6:54 PMLazyColumn
, scrollable
modifier) does not react to 2 finger scroll gestures at all? Easy reproducible with the very simplest LazyColumn
demo (in Thread). I don’t experience this with other devices so far. Actually a dealbreaker for converting an existing App (which relies on accessibility) to compose, as I planned to 😞 Should I file a bug?Kulwinder Singh
11/26/2021, 2:06 AMvar readMore by remember { mutableStateOf(false) }
var clickText by remember { mutableStateOf("Read More") }
var showClickButton by remember { mutableStateOf(false) }
val annotatedText = buildAnnotatedString {
withStyle(style = SpanStyle(color = MaterialTheme.colors.OnSurface800)) {
append(text + " ")
}
if (showClickButton) {
pushStringAnnotation("click", "click")
withStyle(style = SpanStyle(color = MaterialTheme.colors.Interactive500)) {
append(clickText)
}
pop()
}
}
ClickableText(
text = annotatedText,
style = MaterialTheme.typography.smallBody,
overflow = TextOverflow.Ellipsis,
maxLines = if (readMore) Int.MAX_VALUE else 2,
onTextLayout = { showClickButton = it.hasVisualOverflow }
)
I am trying to “Read More” button at the end of text view but looks like buildAnnotatedString
does not recompose when showClickButton
or state change, so here how can i achieve this ?Mehdi Haghgoo
11/26/2021, 5:02 AMAnytime the Compose UIWhat does this mean? why is Compose UI view detached from its window when the transition starts?is used as part of a transition, it will be detached from its window when the transition starts instead of when the transition ends, thus causing your composable to dispose of its state while it is still on screen.View
sindrenm
11/26/2021, 8:33 AMView.measure
crashes in Accompanist (probably accompanist-pager) starting on v0.19.0? Suspect it comes from the refactor to using a LazyList
introduced in that version, and we're seeing it across multiple devices in production, but we're unable to reproduce it locally, and we're a little lost on how to debug this. 😅
GitHub issue: https://github.com/google/accompanist/issues/847allan.conda
11/26/2021, 9:40 AMrsktash
11/26/2021, 10:57 AMModifier.animateItemPlacement()
function of lazy list. There is a bug when we add an item to the first index of a lazy list which is full and scrollable at this moment. When it is not full added item is animated but when it is full it is not animating.
As a workaround I added extra item to the top of lazy list via
item("hint") { }
Michael Paus
11/26/2021, 11:51 AMDaniele Segato
11/26/2021, 1:06 PMTextFieldValue
for forms. Say you need to control both the text and the selected state from the ViewModel.
How do you handle this scenario?Arpit Shukla
11/26/2021, 1:18 PM@Immutable
and now the app started crashing.
@Immutable
data class EqualSplit(
val name: String,
val image: String,
val number: String,
val selected: Boolean
)
The error log says:
java.lang.NoSuchFieldError: No static field $stable of type I in class EqualSplit; or its superclasses
What does this mean?Arpit Shukla
11/26/2021, 3:23 PM@Immutable
might fix the issue but it didn't. How can I prevent these unnecessary recompositions? Code in 🧵iamthevoid
11/26/2021, 4:08 PMOffsetMapping
mapping correctly. I’ll add scratch in thread.
Logic next
When price entering then filter
of VisualTransformation
calls and i creating Price
object. It contains three values integer(string, with spaces), fractional(string) and boolean describes is there comma or no. This object stores in my class, implements VisualTransformation
and OffsetMapper
. mapping of offset happens based on this object. It stores price (with spaces) and price payload. For example if price
is 8 994,34
payload
should be 8994,34
(witout spaces).
Based on this values i am calculating offset. I even simulate this in scratch file [screenshot] and all looks good. But in dynamic, when i interact with input - i see artifacts! i
For example: when i try to backspace number then backspaced not the number, that i want to backspace, but backspace previous, but not always
And then i understood. The problem is that offsets that i calculate is dynamic. That changes when integer length changes. Example 9 999
offset at position 2, and when i enter another digit whenever 99 989
offset now at position 3. So when i backspace digit offset positions also changes during editing.
This situation can be solved?Marko Novakovic
11/26/2021, 8:25 PMMap
like: mutableStateOf(map)
and reassigning that Map
doesn’t trigger recomposition? how can I approach this?Stylianos Gakis
11/26/2021, 10:52 PM@DisallowComposableCalls
that I can apply to my own functions to not allow them to be called from inside composable functions?
Or if not, any ideas on how to improve the developer experience regarding this: I have a function that looks like this:
inline val Int.dp: Int
get() = (this * Resources.getSystem().displayMetrics.density).toInt()
That is used from normal non-composable functions, but is simply annoying as it always comes as a code completion suggestion when I’m inside composable functions, but in there I always want the androidx.compose.ui.unit.dp
import instead.ursus
11/27/2021, 5:03 AMMjahangiry75
11/27/2021, 9:26 AMcompose
?Zoltan Demant
11/28/2021, 10:27 AMLazyList
with a column that contains several sub-items (e.g. inside a card). How can I optimize it such that the nested items arent recomposed all the time? Im seeing 3 recompositions each time the list is recomposed, taking up about 15 ms each; since Im also using a pager, the same process is repeated for pages to the left/right of the current one, effectively taking up 135 ms everytime the list recomposes.Alexander Suraphel
11/28/2021, 1:35 PMtodoapp
inside compose-jb
and getting the following error:
The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.compose.material:material:1.1.0-beta01.
AAR metadata file: /Users/alexander/.gradle/caches/transforms-3/137251a10d2c5151ea1d3a5bd29928e0/transformed/jetified-material-1.1.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
How do if fix this? I’ve tried clean
-> build
and “Invalidate cache and restart”Archie
11/28/2021, 6:25 PMnavigation(
route = "routeName",
startDestination = "startDestination"
) {
// transitions defined in this composable never seem to run
composable(
route = "someDestination",
enterTransition = { slideIntoContainer(AnimatedContentScope.SlideDirection.End) },
exitTransition = { slideOutContainer(AnimatedContentScope.SlideDirection.Start) },
popEnterTransition = { slideIntoContainer(AnimatedContentScope.SlideDirection.End) },
popExitTransition = { slideOutContainer(AnimatedContentScope.SlideDirection.End) },
) {
...
}
...
}
Rudolf Tammekivi
11/28/2021, 8:41 PMKiprop Victor
11/29/2021, 10:15 AMMichal
11/29/2021, 12:24 PMJavier
11/29/2021, 2:30 PManimateContentSize
to expand the component from the center instead of from the left to right?John Aoussou
11/29/2021, 3:17 PMAmrJyniat
11/29/2021, 5:24 PMcoordinates.positionInRoot()
and coordinates.positionInParent()
?Dan Peluso
11/29/2021, 6:56 PMe: This version (1.0.5) of the Compose Compiler requires Kotlin version 1.5.31 but you appear to be using Kotlin version 1.6.0 which is not known to be compatible. Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
mcpiroman
11/29/2021, 7:37 PMfillMaxWidth
inside sth with `horizontalScroll`(by default it is ignored)?
I simply want the background to span all available width.jeff
11/29/2021, 8:38 PMAlignment.TopStart
-> Alignment.BottomStart
within a Box
?
Possibly-related: can ConstraintLayout animate between constraints (via movement not just crossfade or something)?jeff
11/29/2021, 8:38 PMAlignment.TopStart
-> Alignment.BottomStart
within a Box
?
Possibly-related: can ConstraintLayout animate between constraints (via movement not just crossfade or something)?bohregard
11/29/2021, 8:39 PMBiasAlignment(
-1f,
placeholderAlignment
)
val placeholderAlignment by animateFloatAsState(targetValue = if (isFocused || text.isNotEmpty()) -1f else 0f)
jeff
11/29/2021, 8:40 PMbohregard
11/29/2021, 8:40 PMjeff
11/29/2021, 8:41 PMAdam Powell
11/29/2021, 8:48 PMDoris Liu
11/29/2021, 8:58 PMonPlaced
modifier: https://twitter.com/TashaRamesh/status/1461289694616907777animatePlacement
in the sample code here (https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onPlaced(kotlin.Function1) ) to animate movement for when constraints change in a ConstraintLayout.
Alternatively, ConstraintLayout has an API for animating between constraints: https://github.com/androidx/constraintlayout/blob/main/constraintlayout/compose/sr[…]main/java/androidx/constraintlayout/compose/ConstraintLayout.ktjeff
11/29/2021, 9:04 PMremember { SomeCustomAnimatedAlignment(...) }
?Adam Powell
11/29/2021, 10:41 PMPulak
11/30/2021, 4:39 PMDoris Liu
11/30/2021, 7:26 PMonPlaced
is designed to make that change (from center of screen to somewhere else) animatable. Check out the sample code animatePlacement
linked above. If you add animatePlacement
modifier to your element that you intend to move, you can expect the position change to be animated.
We do plan on having official support for the animatePlacement
concept in the near future. But because of onPlaced
being experimental, we can't build animation APIs on top of it just yet.