sheets icon indicating copy to clipboard operation
sheets copied to clipboard

three-level linkage

Open Czdzdz opened this issue 2 years ago • 6 comments

Hello, how can I extend the effect of three-level linkage ?

Czdzdz avatar Jul 19 '23 08:07 Czdzdz

Hi, not very clear about this effect, any further details about the three-level linkage effect?

dokar3 avatar Jul 19 '23 09:07 dokar3

Closed = dismiss, Peeked = 10% Half = 50% Full = 90%

Czdzdz avatar Jul 19 '23 09:07 Czdzdz

  • Peeked state supports a friction height PeekHeight.fraction(Float).
  • There is no Half state here, the default Peeked state is a Half state since its peek height is PeekHeight.fraction(0.5f).
  • The height of the Expanded state is the same height as the sheet content, so you can use Modifier.fillMaxHeight(friction) for your content.

dokar3 avatar Jul 19 '23 09:07 dokar3

Hi! It's possible swipe with finger to not only 3 states, but more? Just like topicstarter asked? Closed = dismiss, Peeked = 10% Half = 50% Full = 90% like here

enum class HideableBottomSheetValue {
    Hidden,
    HalfExpanded,
    Expanded;

    val draggableSpaceFraction: Float
        get() = when (this) {
            Hidden -> 0f
            HalfExpanded -> 0.5f
            Expanded -> 1f
        }
}

And for example add NotSoHidden -> 0.1

borisphen avatar Feb 09 '24 07:02 borisphen

@borisphen I'd say no, currently, that's not possible. It was designed to have only three states, and the current API is difficult to change to meet this requirement. Might make it accept an anchor list on the next rewrite.

dokar3 avatar Feb 09 '24 09:02 dokar3

Thanks for your response!

borisphen avatar Feb 09 '24 09:02 borisphen