How can I have a bottom sheet with a fixed min siz...
# compose-android
t
How can I have a bottom sheet with a fixed min size and when I scroll up it switches the content and goes up until the full new content is showing? Or, as alternative, how can I set the size to trigger
ModalBottomSheetLayout.HalfExpanded
?
a
the phrasing is a bit confusing. do u want to change the contents of your sheet after a specific threshold and also automatically expand it fully?
t
Exactly, imagine it kinda like a footer of 100.dp, when you drag up the footer view fades and the full content show up in the bottom sheet. If you drag down the footer view is back and the content fades. Is it clearer like this? 😅
I solved but not with a BottomSheet, basically I had to create a custom one by myself, then I lay the views with alpha 0 to calculate their size and based on that I limit the drag to expand or shrink
a
im not entirely use why you need to calculate any size, but im glad u made it work for future reference there is a
progress
property on the sheet's state u can use to check the amount dragged between 2 states
t
Yeah but it doesn’t really work when the size changes, at least I couldn’t make it work well
a
ic. yeah a lot of people mentioned material bottom sheets dont play nice with dynamic content. I just built a renderless sheet for composablescore.com that supports dynamic sizing out of the box. haven't tested that particular case but it should work automatically (check state's
offset
) Headsup if u ever don't want to maintain your own bottom sheet implementation.
t
I would love to try it but my company is a bit strict, any new lib needs to be approved, so the bureaucracy is a bit annoying 😓
😭 1
🫂 1
172 Views