So i'm using a ModalBottomSheetLayout inside an LazyColumn. The Modalsheet comes up on the button cl...
d
So i'm using a ModalBottomSheetLayout inside an LazyColumn. The Modalsheet comes up on the button click which is one of the item of the LazyColumn. And i'm getting this error
java.lang.IllegalStateException: Nesting scrollable in the same direction layouts like ScrollableContainer and LazyColumn is not allowed.
is this something i need to take care while using the ModalBottomSheet inside a LazyColumn
Also, it looks like we cannot use a BottomSheet as well from within the LazyList Item
@Andrey Kulikov any thoughts on this
a
why do you add BottomSheet inside LazyColumn? BottomSheet can’t be put inside the scrollable container as it is scrollable on its own.
your main content like the LazyColumn should be defined where “Text(“Rest of the UI”)” is defined in the sample
d
Okay i see how this is supposed to be implemented. Is there any other component which i can use instead of modalsheet/bottomsheet
i guess we can use Dialogs can be used anything else which i might be missing ?
j
ModalBottomSheetLayout is what you wanna go for if you're building a UI with a bottom sheet, dialogs serve a bit of a different purpose
d
But i guess even the ModalBottomSheetLayout would not work within a lazyColumm
I just need to implememt a Mutiselect list, i was using a dialog to show it, but our UX teams had a different idea to show that 😇
j
I think you might have the responsibilities switched up - the ModalBottomSheetLayout is a container that wraps whatever body content you might have in order to layout correctly and make things swipeable. The ModalBottomSheetLayout doesn't work within a lazy column because it uses the swipeable modifier. The
LazyColumn
(or whatever you want to use for your list) would go into the ModalBottomSheet's
sheetContent
slot, all the body content would go into the
content
slot. Think of a ModalBottomSheetLayout a bit like a CoordinatorLayout - you wouldn't host that in a list either.
d
Thank you explaining this. Now i know how it is supposed to be implemented
s
Hi @Deepak Gahlot i have the same case how do you solve this issue i have ModalBottomSheetLayout inside LazyColumn So can you give me some details to solve this problem
d
Ya I used a dialog and displayed the list in that.
666 Views