I have a scrollable column (non lazy) and I do my...
# compose-android
c
I have a scrollable column (non lazy) and I do myStuff.forEach{ someCard(stuffItem) } and someCard inside also does a forEach which outputs content. Essentially the list if 5 "cards" and then each card has a row item inside of it. How can I scroll to an inner item position? i.e. I want to scroll to a specific item within a specific card?
f
Which outputs content in what type of parent? It outputs the content i presume in a column/row, you can control that scrollable state?
c
The outer forloop + column is scrollable. The inner forloop is a column, but not scrollable. But the entire page scrolls just fine because of the outer scrollable column.
o
If I am not mistaken the ScrollState has no method to scroll to the specific item, it scrolls only to the given offset. So you have to remember some map with global indices and offsets which you will fill in each items "onGloballyPositioned" modifier. And then you could use that map to identify offset of the each item and scroll to it.
f
You can always use a lazycolumn within lazycolumn and scroll to item position, no?
o
use a lazycolumn within lazycolumn
It is not allowed, you will get a runtime exception: Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed. You may also want to mimic cards and theirs content in one LazyColumn, but it is a bit tricky task to do if you want shadows to work correctly. See: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1679393034780109?thread_ts=1679294257.066489&cid=CJLTWPH7S