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 = {},
|
actions: @Composable RowScope.() -> Unit = {},
|
||||||
confirmButton: @Composable (() -> Unit)? = null,
|
confirmButton: @Composable (() -> Unit)? = null,
|
||||||
dismissButton: @Composable (() -> Unit)? = null,
|
dismissButton: @Composable (() -> Unit)? = null,
|
||||||
|
swipeToDismiss: () -> Boolean = { true },
|
||||||
content: @Composable () -> Unit,
|
content: @Composable () -> Unit,
|
||||||
) {
|
) {
|
||||||
val swipeState = remember {
|
val swipeState = remember {
|
||||||
SwipeableState(
|
SwipeableState(
|
||||||
initialValue = SwipeState.Dismiss,
|
initialValue = SwipeState.Dismiss,
|
||||||
confirmStateChange = {
|
confirmStateChange = {
|
||||||
if (it == SwipeState.Dismiss) onDismissRequest()
|
if (it == SwipeState.Dismiss) {
|
||||||
|
if (swipeToDismiss()) onDismissRequest()
|
||||||
|
else return@SwipeableState false
|
||||||
|
}
|
||||||
return@SwipeableState true
|
return@SwipeableState true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@ -47,6 +47,7 @@ fun CustomizeSearchableSheet(
|
|||||||
title = {
|
title = {
|
||||||
Text(stringResource(if (pickIcon) R.string.icon_picker_title else R.string.menu_customize))
|
Text(stringResource(if (pickIcon) R.string.icon_picker_title else R.string.menu_customize))
|
||||||
},
|
},
|
||||||
|
swipeToDismiss = { !pickIcon },
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
if (pickIcon) {
|
if (pickIcon) {
|
||||||
OutlinedButton(onClick = { viewModel.closeIconPicker() }) {
|
OutlinedButton(onClick = { viewModel.closeIconPicker() }) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user