Fix the build: AnimatedVisibility resolved to the RowScope overload

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) <noreply@anthropic.com>
This commit is contained in:
anas 2026-10-07 16:54:59 +02:00
parent f0c1dd5541
commit a118fc2510

View File

@ -224,23 +224,37 @@ fun ColumnBrowser(
} }
// Reader view: the page has the whole screen, and one button, at the edge the // Reader view: the page has the whole screen, and one button, at the edge the
// columns went to, brings them back as they were. // columns went to, brings them back as they were.
AnimatedVisibility( ShowColumnsButton(
visible = hidden, visible = hidden,
enter = scaleIn() + fadeIn(), onShow = { settings.update { it.copy(columnsHidden = false) } },
exit = scaleOut() + fadeOut(),
modifier = Modifier modifier = Modifier
.align(Alignment.BottomStart) .align(Alignment.BottomStart)
.navigationBarsPadding() .navigationBarsPadding()
.padding(16.dp), .padding(16.dp),
)
}
}
}
/**
* 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( SmallFloatingActionButton(onClick = onShow) {
onClick = { settings.update { it.copy(columnsHidden = false) } },
) {
Icon(Icons.Default.Menu, stringResource(R.string.show_columns)) Icon(Icons.Default.Menu, stringResource(R.string.show_columns))
} }
} }
}
}
} }
/** Folds the columns away so the page has the whole screen (reader view). */ /** Folds the columns away so the page has the whole screen (reader view). */