From a118fc25109166805bb50198ab372a120a5db098 Mon Sep 17 00:00:00 2001 From: anas Date: Wed, 7 Oct 2026 16:54:59 +0200 Subject: [PATCH] Fix the build: AnimatedVisibility resolved to the RowScope overload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main did not compile. The floating button that brings the columns back sits in a Box, but that Box is inside the browser's Row, so RowScope was still an implicit receiver where AnimatedVisibility was called. Kotlin picked RowScope.AnimatedVisibility — which has no alignment parameter and cannot take an implicit receiver there — and the Kotlin compile failed. Moving it into its own composable gives it a scope of its own, so the plain overload resolves and Modifier.align stays with the Box that provides it. Co-Authored-By: Claude Opus 5 (1M context) --- .../com/ganjoor/android/ui/ColumnBrowser.kt | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/ganjoor/android/ui/ColumnBrowser.kt b/app/src/main/java/com/ganjoor/android/ui/ColumnBrowser.kt index d49576e..cd98363 100644 --- a/app/src/main/java/com/ganjoor/android/ui/ColumnBrowser.kt +++ b/app/src/main/java/com/ganjoor/android/ui/ColumnBrowser.kt @@ -224,21 +224,35 @@ fun ColumnBrowser( } // Reader view: the page has the whole screen, and one button, at the edge the // columns went to, brings them back as they were. - AnimatedVisibility( + ShowColumnsButton( visible = hidden, - enter = scaleIn() + fadeIn(), - exit = scaleOut() + fadeOut(), + onShow = { settings.update { it.copy(columnsHidden = false) } }, modifier = Modifier .align(Alignment.BottomStart) .navigationBarsPadding() .padding(16.dp), - ) { - SmallFloatingActionButton( - onClick = { settings.update { it.copy(columnsHidden = false) } }, - ) { - Icon(Icons.Default.Menu, stringResource(R.string.show_columns)) - } - } + ) + } + } +} + +/** + * Brings the columns back from reader view. + * + * In its own composable because the Box it is placed in sits inside the browser's Row: with + * RowScope still an implicit receiver there, `AnimatedVisibility` resolves to the row overload, + * which takes no alignment and does not compile. A function of its own has only its own scope. + */ +@Composable +private fun ShowColumnsButton(visible: Boolean, onShow: () -> Unit, modifier: Modifier = Modifier) { + AnimatedVisibility( + visible = visible, + enter = scaleIn() + fadeIn(), + exit = scaleOut() + fadeOut(), + modifier = modifier, + ) { + SmallFloatingActionButton(onClick = onShow) { + Icon(Icons.Default.Menu, stringResource(R.string.show_columns)) } } }