• Sergey Y.

    Sergey Y.

    11 months ago
    While browsing CLs, I noticed this one about documentation updates, which is good. However, inside the code on
    line 157
    , I saw the comment
    "Don't do this."
    But why? I know that
    .onSizeChanged
    will only fire after the first composition, and we have to wait to get the required attribute. This seems acceptable to me. What other ways can we get the attributes of the child layout besides writing a custom layout using
    Layout
    composable or
    Modifier.layout
    ?https://android-review.googlesource.com/c/platform/frameworks/support/+/1856275/7/compose/in[…]va/androidx/compose/integration/docs/phases/Phases.kt
    Sergey Y.
    Albert Chang
    +1
    6 replies
    Copy to Clipboard
  • b

    bodo

    11 months ago
    Hi guys. I am searching for a way to write a custom modifier, which scales the font size if the composable has a specific size (width)
    Text("This is a test", modifier = Modifier.dynamicTextSize(14.sp))
    • composable width <=100dp it should use the specified 14.sp • composable width > 100dp it should use the specified 14.sp multiplied with a scale factor -> e.g. scalefactor = 1.5 * 14.sp = 21.sp Can you please show me how to achieve this best? Thx
    b
    Lucien Guimaraes
    +1
    4 replies
    Copy to Clipboard
  • j

    jannis

    11 months ago
    I have a
    TextField
    with a
    TextFieldValue
    . When I select a Text the
    onValueChange
    callback is invoked correctly. However when I perform a configuration change the onValueChangecallback is invoked again (before the recomposition is invoked). This time with wrong values. The selection is cleared. When I use a
    remembersaveable
    it works more or less. It seems the selection is restored with the correct values (even though the context menu on the text is missing). It seems it simply doesn't update it before the recomposition. Since my state is more complex I store the value in my
    ViewModel
    . Of course the value get's updated with the wrong state before the recomposition. Any ideas how to solve this? Or is it a bug?
    j
    Albert Chang
    +1
    7 replies
    Copy to Clipboard
  • a

    Arpit Shukla

    11 months ago
    How to set a progress listener to compose animations? I am trying to use
    animateFloatAsState
    , I see that it accepts a
    finishedListener
    but how to provide something like an
    updateListener
    ?
    a
    maciejciemiega
    12 replies
    Copy to Clipboard
  • i

    Ink

    11 months ago
    I use
    HorizontalPager
    and I want to make second item visible. I"ve added itemSpacing but it doesn't work, any idea?
    HorizontalPager(state = pagerState, itemSpacing = 35.dp) {
        HorizontalViewPagerItem()
    }
    i
    Lucien Guimaraes
    4 replies
    Copy to Clipboard
  • m

    mattinger

    11 months ago
    Looking for an approach to trigger an event in a lazy column when a card is scrolled into view. At the moment, i am using a LaunchedEffect (though suspect SideEffect would be enough). Let’s for now at least assume the composition doesn’t change over time, just scrolls on and off screen. I’m wondering if this is the right approach (see thread for code)
    m
    Adam Powell
    +1
    14 replies
    Copy to Clipboard
  • a

    alorma

    11 months ago
    Hi! Is this the best way to get
    onStart
    events in compose? Code in 🧵
    a
    m
    +2
    18 replies
    Copy to Clipboard
  • b

    Bradleycorn

    11 months ago
    I’m working with a
    Row
    that renders itself like the image here. In the Row, the red/blue box should fill the height of the row, but also not affect the measured height. Meaning, the other content should determine the height of the row, and then the red/blue box should fill that height. I was using
    InstrinsicSize.Min
    to accomplish this. But alas, the row content has gotten complex enough that I need to use a
    SubComposeLayout
    in it (a
    BoxWithConstraints
    ), and well, Intrinsics and SubComposeLayout don’t play nice together. I had been working on this before, and @Zach Klippenstein (he/him) [MOD] had helped me in another thread (https://kotlinlang.slack.com/archives/CJLTWPH7S/p1621712795136000), suggesting that I use a Custom Layout for the Row composable. I’m finally getting a chance to work on that. The code I’ve come up with as a starting point for my custom Layout is included in this thread. I was hoping to get some feedback to see if I’m on the right track with it, since it’s my first attempt at a custom layout….
    b
    Zach Klippenstein (he/him) [MOD]
    10 replies
    Copy to Clipboard
  • Chris Johnson

    Chris Johnson

    11 months ago
    Is there a reason
    Modifier.offset
    causes recomposition infinitely when I'm not touching the screen? I'm using it together with
    animateIntOffset
    + user scroll. Code in 🧵
    Chris Johnson
    Doris Liu
    +1
    22 replies
    Copy to Clipboard
  • t

    Tolriq

    11 months ago
    Since LazyVerticalGrid does not support span for headers I'm trying to use a LazyColumn with Grid and windowed on the list. Since I need fixed counts the elements have all weight(1f) and aspectRatio() for some part of the content but performance is not great at all. Is there something more efficient than the weight or anything I can do to hint the LazyColumn that all rows will have the same height to improve perf?
    t
    Andrey Kulikov
    13 replies
    Copy to Clipboard