Drop the back preview when the surface is shown again

This commit is contained in:
makiolaj committed 2026-09-27 12:06:45 +02:00
1 parent 1ab46897c3
commit 1d6b1ed2a9
3 files changed
+38 -10

No files matched your search

@@ -45,7 +45,9 @@ import de.jeanlucmakiola.floret.identity.predictiveBack
* Optional extras, all defaulting to the bare scaffold so existing callers are
* unchanged: [actions] adds trailing app-bar items; [snackbarHost] hosts
* transient messages; [predictiveBack] (off by default) wires the gesture
* preview to [onBack] for full-screen surfaces that want it.
* preview to [onBack] for full-screen surfaces that want it, with [visible]
* passed through to [Modifier.predictiveBack] for a surface that is shown and
* hidden in place.
*
* Set [scrollable] to false when [content] brings its own scrolling container.
* The default column scrolls as a whole, which composes every row up front —
@@ -65,6 +67,7 @@ fun CollapsingScaffold(
modifier: Modifier = Modifier,
largeTopBar: Boolean = true,
predictiveBack: Boolean = false,
visible: Boolean? = null,
scrollable: Boolean = true,
actions: @Composable RowScope.() -> Unit = {},
snackbarHost: @Composable () -> Unit = {},
@@ -77,7 +80,7 @@ fun CollapsingScaffold(
}
Scaffold(
modifier = modifier
.then(if (predictiveBack) Modifier.predictiveBack(onBack = onBack) else Modifier)
.then(if (predictiveBack) Modifier.predictiveBack(onBack = onBack, visible = visible) else Modifier)
.fillMaxSize()
.background(MaterialTheme.colorScheme.surface)
.nestedScroll(scrollBehavior.nestedScrollConnection),