title: How to detect scroll behaviour in LazyColumn?
body: <p>I'm trying to detect three scenarios :</p>
  <p>1.- User scroll vertically (down) and notify to hide a button</p>
  <p>2.- User stop scrolls and notify to hide button</p>
  <p>3.- User scroll vertically (up) and notify to show the button</p>
  <p>4.- User is in the bottom of the list and there are no more items and notify to show the button.</p>
  <p>What I've tried is :</p>
  <p>First approach is to use <code>nestedScrollConnection</code> as follows</p>
  <pre><code>val isVisible = remember { MutableTransitionState(false) }
                  .apply { targetState = true }
  val nestedScrollConnection = remember {
                  object : NestedScrollConnection {
                      override fun onPreScroll(
                          available: Offset,
                          source: NestedScrollSource
                      ): Offset {
                          return Offset.Zero
                      }
  
                      override fun onPostScroll(
                          consumed: Offset,
                          available: Offset,
                          source: NestedScrollSource
                      ): Offset {
                          isVisible.targetState = false
                          return super.onPostScroll(consumed, available, source)
                      }
                  }
              }
  LazyColumn(
                  modifier = Modifier
                      .padding(start = 16.dp, end = 16.dp, top = 16.dp)
                      .nestedScroll(nestedScrollConnection),
                  verticalArrangement = Arrangement.spacedBy(16.dp),
              )
  </code></pre>
  <p>What I've tried is when y &gt; 0 is going up, else is going down, but the others I don't know how to get them.</p>
  <p>Another approach I followed is :</p>
  <pre><code>val scrollState = rememberLazyListState()
  LazyColumn(
                  modifier = Modifier
                      .padding(start = 16.dp, end = 16.dp, top = 16.dp),
                  verticalArrangement = Arrangement.spacedBy(16.dp),
                  state = scrollState,
  </code></pre>
  <p>But I don't know how to get if it's last item or not, I can get if the scroll is in progress.</p>
  <h2>Note</h2>
  <p>Answer from Skizo works but with this it's a bit weird because if you scroll up slowly the Y sometimes is not what I want and then hide it again, is there any way to leave some scroll to start reacting to this? For instance, scroll X pixels to start showing / hiding.</p>
  <p>What I want is to hide/show is a Float Action Button depending on the scroll (the scenarios are the ones from above)</p>
  <p>I've found this way, but it is using the offset and I'd like to animate the <code>FloatActionButton</code> instead of appearing from the bottom like a fade in/fade out I was using the <a href="https://developer.android.com/reference/kotlin/androidx/compose/animation/package-summary#AnimatedVisibility(kotlin.Boolean,androidx.compose.ui.Modifier,androidx.compose.animation.EnterTransition,androidx.compose.animation.ExitTransition,kotlin.Function1)" rel="nofollow noreferrer">Animation Visibility</a> and I got this working with fade in/fade out but now, how can I adapt the code from github to use <code>Animation Visibility</code>? And also add this when the user ends scrolling that from now in the code is just while scrolling</p>