Bottom sheets: add back key handler
This commit is contained in:
parent
3516597d10
commit
903c161500
@ -1,5 +1,6 @@
|
||||
package de.mm20.launcher2.ui.component
|
||||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.animation.core.spring
|
||||
import androidx.compose.foundation.background
|
||||
@ -99,6 +100,15 @@ fun BottomSheetDialog(
|
||||
)
|
||||
}
|
||||
|
||||
BackHandler {
|
||||
if (dismissible()) {
|
||||
scope.launch {
|
||||
draggableState.animateTo(SwipeState.Dismiss)
|
||||
onDismissRequest()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(draggableState.currentValue) {
|
||||
if (isOpenAnimationFinished && draggableState.currentValue == SwipeState.Dismiss) {
|
||||
onDismissRequest()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user