From a324fcc8d3f4ffe21a7e56c1c37a61d71c4ee3af Mon Sep 17 00:00:00 2001 From: Alex Vanyo Date: Mon, 6 May 2024 11:41:56 -0700 Subject: [PATCH] Fix state loss with workaround Change-Id: I96025bd8b2f4f59019df95d1391b832249e7dc91 --- .../google/samples/apps/nowinandroid/ui/NiaApp.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaApp.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaApp.kt index 4c8232a26..a381298c0 100644 --- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaApp.kt +++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaApp.kt @@ -201,13 +201,13 @@ internal fun NiaApp( } Box( - modifier = if (shouldShowTopAppBar) { - Modifier.consumeWindowInsets( - WindowInsets.safeDrawing.only(WindowInsetsSides.Top), - ) - } else { - Modifier - }, + modifier = Modifier.consumeWindowInsets( + if (shouldShowTopAppBar) { + WindowInsets.safeDrawing.only(WindowInsetsSides.Top) + } else { + WindowInsets(0, 0, 0, 0) + }, + ), ) { NiaNavHost( appState = appState,