Hi all. I’m trying in implement a Scaffold Type c...
# compose
m
Hi all. I’m trying in implement a Scaffold Type component, which will monitor scroll state, and when the Column/LazyColumn is not fully scrolled to the bottom, will present a clickable item to make it scroll down a single page. I’ve got all that working, but the issue i’m having is that I can’t really make it work for LazyColumn using the same code as Column. The issue is really calculating how far to scroll down, because LazyListState and ScrollState have different ways of determining where in the scrolling you are.
Copy code
@Composable
fun CLScrollHintScaffold(
    modifier: Modifier = Modifier,
    hint: String,
    onHintClicked: (ScrollState) -> Unit,
    scrollState: ScrollState = rememberScrollState(),
    content: @Composable (PaddingValues) -> Unit
) {
    val isNotFullyScrolled = scrollState.value < scrollState.maxValue

    Scaffold(
        modifier = modifier,
        floatingActionButton = {
            if (isNotFullyScrolled) {
                CLHint(
                    hint = hint,
                    iconType = CLIconType.HintScrollDown,
                    onClick = {
                        onHintClicked(scrollState)
                    }
                )
            }
        },
        floatingActionButtonPosition = FabPosition.Center
    ) {
        content(it)
    }
}
And yes i could do some casting of ScrollableState and switch conditions, but that seems odd to me.