Prevent customize sheet to be dismissed by swipe when icon picker is open
This commit is contained in:
parent
d5aa0667ad
commit
b9e65f3c9f
@ -36,13 +36,17 @@ fun BottomSheetDialog(
|
||||
actions: @Composable RowScope.() -> Unit = {},
|
||||
confirmButton: @Composable (() -> Unit)? = null,
|
||||
dismissButton: @Composable (() -> Unit)? = null,
|
||||
swipeToDismiss: () -> Boolean = { true },
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
val swipeState = remember {
|
||||
SwipeableState(
|
||||
initialValue = SwipeState.Dismiss,
|
||||
confirmStateChange = {
|
||||
if (it == SwipeState.Dismiss) onDismissRequest()
|
||||
if (it == SwipeState.Dismiss) {
|
||||
if (swipeToDismiss()) onDismissRequest()
|
||||
else return@SwipeableState false
|
||||
}
|
||||
return@SwipeableState true
|
||||
}
|
||||
)
|
||||
|
||||
@ -47,6 +47,7 @@ fun CustomizeSearchableSheet(
|
||||
title = {
|
||||
Text(stringResource(if (pickIcon) R.string.icon_picker_title else R.string.menu_customize))
|
||||
},
|
||||
swipeToDismiss = { !pickIcon },
|
||||
confirmButton = {
|
||||
if (pickIcon) {
|
||||
OutlinedButton(onClick = { viewModel.closeIconPicker() }) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user