From 9d134be6212f9c563416b762c0145b6df38c918a Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Sun, 28 Jun 2026 19:15:24 +0200 Subject: [PATCH] =?UTF-8?q?nav:=20fix=20blank=20back-gesture=20preview=20?= =?UTF-8?q?=E2=80=94=20let=20navigation=20drive=20predictive=20back?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The per-screen Modifier.predictiveBack scaled the leaving screen with a graphicsLayer, but NavHost only composes one back-stack entry at a time, so nothing was drawn behind the shrinking screen — the gesture revealed the white window background instead of the previous screen. Drive predictive back through navigation-compose instead: it composes the destination being revealed and seeks popExit with the gesture. popExit is now a scaleOut + fade peek, so the leaving screen shrinks to reveal the real previous screen held static. Drops the predictiveBack modifier from the destinations and Settings (its inner section BackHandler is unchanged). The kit's predictiveBack stays for overlay-style screens. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../agendula/ui/navigation/AgendulaNavHost.kt | 15 ++++++--------- .../agendula/ui/settings/SettingsScreen.kt | 4 ---- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaNavHost.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaNavHost.kt index 9f1f771..c43850e 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaNavHost.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaNavHost.kt @@ -1,9 +1,10 @@ package de.jeanlucmakiola.agendula.ui.navigation -import de.jeanlucmakiola.floret.identity.predictiveBack import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.scaleOut import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Modifier @@ -40,14 +41,13 @@ fun AgendulaNavHost(modifier: Modifier = Modifier) { modifier = modifier, // Only the screen on top moves; the background is always held static. // Forward is a plain fade-in over the held screen — calm, not a slide. - // Back is the system predictive-back peek: each destination applies - // Modifier.predictiveBack, so the leaving screen scales/rounds with the - // gesture and the held screen is revealed unmoved. NavHost itself does no - // pop animation (the screen owns the motion). + // Back is the predictive-back peek: navigation-compose composes the + // screen being revealed underneath and seeks popExit with the gesture, so + // the leaving screen scales down to reveal the (unmoved) previous screen. enterTransition = { fadeIn() }, exitTransition = { ExitTransition.None }, popEnterTransition = { EnterTransition.None }, - popExitTransition = { ExitTransition.None }, + popExitTransition = { scaleOut(targetScale = 0.9f) + fadeOut() }, ) { composable(Dest.LISTS) { ListsScreen( @@ -71,7 +71,6 @@ fun AgendulaNavHost(modifier: Modifier = Modifier) { LaunchedEffect(filter) { vm.bind(filter) } TaskListScreen( - modifier = Modifier.predictiveBack(onBack = { nav.popBackStack() }), filter = filter, viewModel = vm, onOpenTask = { taskId -> nav.navigate(Dest.TaskDetail.build(taskId)) }, @@ -89,7 +88,6 @@ fun AgendulaNavHost(modifier: Modifier = Modifier) { LaunchedEffect(taskId) { vm.bind(taskId) } TaskDetailScreen( - modifier = Modifier.predictiveBack(onBack = { nav.popBackStack() }), viewModel = vm, onEdit = { nav.navigate(Dest.TaskEdit.buildEdit(taskId)) }, onDeleted = { nav.popBackStack() }, @@ -118,7 +116,6 @@ fun AgendulaNavHost(modifier: Modifier = Modifier) { } TaskEditScreen( - modifier = Modifier.predictiveBack(onBack = { nav.popBackStack() }), viewModel = vm, onSaved = { nav.popBackStack() }, onBack = { nav.popBackStack() }, diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsScreen.kt index 18c15db..4e3e661 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsScreen.kt @@ -93,7 +93,6 @@ import de.jeanlucmakiola.floret.components.pastelize import de.jeanlucmakiola.floret.components.positionOf import de.jeanlucmakiola.floret.identity.collapseExit import de.jeanlucmakiola.floret.identity.expandEnter -import de.jeanlucmakiola.floret.identity.predictiveBack import de.jeanlucmakiola.floret.reminders.ReminderOverride import de.jeanlucmakiola.agendula.ui.common.reminderLeadTimeLabel @@ -128,9 +127,6 @@ fun SettingsScreen( Box( modifier = modifier - // At the hub, the back gesture previews the pop to the lists overview; - // in a section the BackHandler above takes it (section -> hub) instead. - .predictiveBack(onBack = onBack, enabled = section == null) .fillMaxSize() .background(MaterialTheme.colorScheme.surface), ) {