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
Alex Styl
08/01/2024, 11:46 AM
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
Tgo1014
08/01/2024, 11:54 AM
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? 😅
Tgo1014
08/01/2024, 12:24 PM
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
Alex Styl
08/01/2024, 2:08 PM
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
Tgo1014
08/01/2024, 2:20 PM
Yeah but it doesn’t really work when the size changes, at least I couldn’t make it work well
a
Alex Styl
08/01/2024, 2:25 PM
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
Tgo1014
08/01/2024, 2:36 PM
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 😓