Thread
#compose
    t

    Thierry

    2 years ago
    AdapterList seems to work well 👏
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    2 years ago
    Have you had any issues with
    Ripple
    +
    Clickable
    not working after a lot of scrolling? Maybe just one or the other, I haven’t had time to dig into it.
    t

    Thierry

    2 years ago
    nope not yet
    i do have another problem
    do you know how facebook messenger type of chat has a gradient on the message bubble based on the message bubble's position in the list?
    the adapter list has the current element, but i dont know the position in the visible list
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    2 years ago
    Yea, I think they’re going to need some additional API there. You’d need that to implement stuff like sticky headers as well.
    l

    Leland Richardson [G]

    2 years ago
    cc @Ryan Mentley
    r

    Ryan Mentley

    2 years ago
    you could, as a workaround, encode positional information in the data, or look it up in the source data, etc.
    but yes, we're definitely going to have some additional API here
    also I haven't seen an app on Android do the gradient thing, but I do know what you're referring to
    that's a little bit trickier, because it's not the position in the the list that matters, it's the position within the parent. I don't think AdapterList would have any specific support for that, but I think we should probably find a way that works regardless of what sort of scrolling container you're in
    t

    Thierry

    2 years ago
    yes the gradient changes based on the position of the message bubble compared to the top of the view
    so it's not the position the data list, but the position in the part that's currently shown
    not a very common use case i suppose
    r

    Ryan Mentley

    2 years ago
    Some sort of react-to-position support is, I think, common-ish
    I'm not sure where we are on support for that, though
    you could do some sort of
    OnChildPositioned
    thing and update the data for drawing, I think
    it's a little awkward, but would probably work
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    2 years ago
    I just tried putting an
    OnPositioned
    inside of the list item, and it definitely works!
    AdapterList(data = (1..100).toList()) { item ->
        var bounds by state { "waiting for position…" }
        Stack(modifier = DrawBorder(size = 1.dp, color = Color.Red)) {
          OnPositioned(onPositioned = { coords ->
            bounds = coords.boundsInRoot.toString()
          })
          ListItem(text = item.toString(), overlineText = bounds)
        }
      }
    Ash

    Ash

    2 years ago
    Do you guys have this working with the ROOM ViewModelProvider? Can I see the example? Working on it now but if you have working code, it would save me some time. I have this in a navigation fragment.
    t

    Thierry

    2 years ago
    That's cool @Zach Klippenstein (he/him) [MOD]