Rihards
02/02/2023, 2:13 PMsheetState.show()
? I would like to get it half expanded when user opens it. I tried to use scope.launch { sheetState.animateTo(ModalBottomSheetValue.HalfExpanded) }
, but then app is crashing.Joseph Hawkes-Cates
02/02/2023, 2:49 PMsheetState.show()
docs when the content is smaller than 50% of the screen height the sheet will be shown at half height, otherwise it’s full.Joseph Hawkes-Cates
02/02/2023, 2:52 PMJoseph Hawkes-Cates
02/02/2023, 2:54 PMRihards
02/02/2023, 2:55 PMModalBottomSheetState
, so much of states in the code that Mutable came in mind while writing 😄 But thanks for the info, I assume that there is some kind of logic of when it’s possible to show all data with fully expanded then it’s fully showing up, because I have same bottom sheet implementation in other place in the app and it’s half expanded on opening, but it contains way more data that can’t be fully displayed.Joseph Hawkes-Cates
02/02/2023, 2:55 PMRihards
02/02/2023, 2:58 PMJoseph Hawkes-Cates
02/02/2023, 3:00 PMColton Idle
02/02/2023, 6:29 PMjossiwolf
02/05/2023, 4:47 PMshow()
from 1.4.0-alpha04. Show animates to HalfExpanded if that anchor exists. Modal bottom sheets have a HalfExpanded anchor at 50% of the container height if the sheet content is taller than 50% of the container height.
I believe the crash you're seeing comes from trying to animate to HalfExpanded when you don't have an anchor for it. Make sure your content is tall enough - but if it isn't tall enough in the first place, you shouldn't need a HalfExpanded state anyway.