From 011598d1d8204cfa24f19b7e15fe72a9f72ce3af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=96=D0=B8=D1=80=D0=BA=D0=B5=D0=B2=D0=B8=D1=87?= Date: Mon, 5 Aug 2024 08:55:13 +0300 Subject: [PATCH] fix example insets --- .../commonMain/kotlin/lottiefiles/LottieFilesScreen.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/example/shared/src/commonMain/kotlin/lottiefiles/LottieFilesScreen.kt b/example/shared/src/commonMain/kotlin/lottiefiles/LottieFilesScreen.kt index 5ff438dc..a470a9be 100644 --- a/example/shared/src/commonMain/kotlin/lottiefiles/LottieFilesScreen.kt +++ b/example/shared/src/commonMain/kotlin/lottiefiles/LottieFilesScreen.kt @@ -22,6 +22,7 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width @@ -73,6 +74,7 @@ import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.layout.Measurable import androidx.compose.ui.layout.SubcomposeLayout import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight @@ -146,6 +148,13 @@ internal fun LottieFilesScreen( val pageCount by viewModel.pageCount.collectAsState() val gridState = rememberLazyGridState() + val keyboard = LocalSoftwareKeyboardController.current + LaunchedEffect(gridState.isScrollInProgress){ + if (gridState.isScrollInProgress){ + keyboard?.hide() + } + } + LaunchedEffect(files) { gridState.animateScrollToItem(0) } @@ -277,6 +286,7 @@ internal fun LottieFilesScreen( }, modifier = Modifier .fillMaxWidth() + .navigationBarsPadding() .padding( horizontal = 24.dp, vertical = 12.dp