How can i achieve callback/listener mechanism on JetPack Compose BottomSheet state changes?
Something similar to:
   @Override  
   public void onStateChanged(@NonNull View bottomSheet, int newState) {  
     if (newState == BottomSheetBehavior.STATE_COLLAPSED && mIsCollapsedFromBackPress){
        
     }
   }  
  @Override  
  public void onSlide(@NonNull View bottomSheet, float slideOffset) {  
  }  
});
As we used to do in Java/Kotlin.
Right now I am passing this as lambda to another composable from where the bottomsheet needs to be closed.
    val closeSheet: () -> Unit = {
        scope.launch {
            modalState.hide()
        }
    }
But i want to get the callback that the bottomsheet has been fully collapsed and I can continue my task.
Actual issue i am facing: I am converting a composable to bitmap on a button click. The button is inside the BottomSheet and the composable that needs to be converted is behind the BottomSheet. So, sometimes the bottomsheet also appears in the bitmap. I want to trigger the process only if the bottomsheet is fully collpased.
I found this answer on SO, but still the issue is about the callback. Not sure how to use it.