I need to create a composable that can display an ...
# compose
p
I need to create a composable that can display an Image. That image can be lower than the width/height of the screen, or can be 2x width or height of the screen. If the image is higher than the screen, then, scrollbars must permit you scroll the image. I tryed it adding the image on a row, and that row on a column, both with scrollbars, but that is giving me a lot of issues. Does anyone know how to achieve this correctly?
e
unfortunately there is currently no
Modifier.scrollable2D
. something like that is necessary because otherwise you're locked to scrolling along a single axis at a time
there is a
@ExperimentalFoundationApi Modifier.draggable2D
on which you can build a basic 2D scrollable
adding scrollbars to that probably isn't too hard, but fling and overscroll effects would take some effort
there's been a feature request for a while: https://issuetracker.google.com/issues/214410040
p
e
well yes, if you want zooming too then that would work
there's also third-party libraries like https://github.com/chihsuanwu/compose-free-scroll
but neither is "scrollable with scrollbars in both directions" kodee sad
p
thank you, well, finally I did it embedding the image inside a row and inside a column with scrollbars