https://kotlinlang.org logo
#compose
Title
# compose
a

Anshulupadhyay03

02/25/2023, 9:04 PM
Hi there, I am trying to build similar to https://github.com/InQBarna/TableFixHeaders lib for compose. I have implemented some parts of it with the help of lazyColumn and lazyRow however the horizontal scroll that scrolls the entire content with top headers lags.I want a smooth scroll. Can anyone guide me in the right direction? check out my implementation here with function DrawTableUi https://github.com/youranshul/tableFixheaderCompose/blob/main/app/src/main/java/com/retroent/tablefixheadercompose/drawTableVIew.kt
c

Colton Idle

02/26/2023, 2:08 PM
Are you testing release builds with r8 enabled?
p

Petr Laštovička

02/26/2023, 3:31 PM
Have you tried
LazyGrid
?
a

Anshulupadhyay03

02/26/2023, 6:00 PM
@Colton Idle No i am testing on debug build.
@Petr Laštovička I have not tried with Lazy grid as my problem is not laying out the view but their scroll. Do you really think lazygrid would help?
p

Petr Laštovička

02/26/2023, 6:36 PM
Idk, it just seems like the right tool to do the job I have forgotten we have only directional grids 😅 Still I would try VerticalGrid with horizontalScroll modifier
a

Anshulupadhyay03

02/26/2023, 7:04 PM
@Petr Laštovička would try with verticalGrid,thanks.
m

myanmarking

02/27/2023, 10:12 AM
by doing xxx.toList, you are introducing a lot of recompositions. Try to improve that and see if it betters
c

Colton Idle

02/27/2023, 2:21 PM
Please lookup any convos in this slack channel regarding compose perf. pretty much the first thing the compose team will tell you is to test in release builds with minify = true.
a

Anshulupadhyay03

02/28/2023, 1:47 PM
@Colton Idle I tried with release builds with minify=true but that did not help, however @myanmarking pointing about the recomposition due to xxx.toList() , I fixed that and it did not work but I realized my ListState.firstVisibleItemScrollOffset was causing lots of recomposition. I have found another approach for a workaround though I have some other problems. I will fix a few things and update you guys on the progress and help. Thanks
5 Views