mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
[a11y] Add click action to the message bottom sheet handle (#5228)
This commit is contained in:
committed by
GitHub
parent
f0ba59d84e
commit
66eb876b2d
+14
-2
@@ -60,7 +60,7 @@ import kotlin.math.roundToInt
|
||||
|
||||
@Composable
|
||||
fun ExpandableBottomSheetLayout(
|
||||
sheetDragHandle: @Composable BoxScope.() -> Unit,
|
||||
sheetDragHandle: @Composable BoxScope.(toggleAction: () -> Unit) -> Unit,
|
||||
bottomSheetContent: @Composable ColumnScope.() -> Unit,
|
||||
state: ExpandableBottomSheetLayoutState,
|
||||
maxBottomSheetContentHeight: Dp,
|
||||
@@ -152,7 +152,19 @@ fun ExpandableBottomSheetLayout(
|
||||
}
|
||||
) {
|
||||
Box(Modifier.fillMaxWidth()) {
|
||||
sheetDragHandle()
|
||||
sheetDragHandle {
|
||||
coroutineScope.launch {
|
||||
val destination = if (state.position == ExpandableBottomSheetLayoutState.Position.EXPANDED) {
|
||||
state.internalPosition = ExpandableBottomSheetLayoutState.Position.COLLAPSED
|
||||
minBottomContentHeightPx.toFloat()
|
||||
} else {
|
||||
state.internalPosition = ExpandableBottomSheetLayoutState.Position.EXPANDED
|
||||
calculatedMaxBottomContentHeightPx.toFloat()
|
||||
}
|
||||
animatable.snapTo(currentBottomContentHeightPx.toFloat())
|
||||
animatable.animateTo(destination)
|
||||
}
|
||||
}
|
||||
}
|
||||
bottomSheetContent()
|
||||
}
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ class ExpandableBottomSheetLayoutState {
|
||||
/**
|
||||
* The current position of the bottom sheet layout.
|
||||
*/
|
||||
val position = internalPosition
|
||||
val position get() = internalPosition
|
||||
|
||||
/**
|
||||
* The percentage of the bottom sheet layout that is currently being dragged.
|
||||
|
||||
Reference in New Issue
Block a user