Hello everyone, hope you are all doing well! I am ...
# compose-android
d
Hello everyone, hope you are all doing well! I am trying to implement a screen which has small part of the other screen displayed at the bottom. When user swipes up the whole screen is then displayed Now, I implemented this with a custom state and
BottomSheetScaffold
and I don't like it. It is not anywhere within the navigation system. How do you recommend this be implemented? I want to decouple those 2 screens as much as possible even though small top part of the other is being displayed over the main screen
s
Since they're both showing at the same time, it sounds to me like you can't treat those as two separate navigation destinations really. At least with the classic compose navigation library. With that said, there's nothing stopping you from having the screen composable public which you call from both destinations. Smth like:
Copy code
composable("route1") {
  Screen1()
}
composable("route2") {
  Screen2()
}

...

composable fun Screen1() {
 ScreenOneScaffold {
  Screen1Contents()
  Something {
   Screen2Contents()
  }
 }
}

composable fun Screen2() {
  Screen2Contents()
}

composable fun Screen2Contents(){}
So you can just re-use the UI for it normally. It would still be two separate destinations as far as you navigation is concerned, sure, but that should be fine.
d
Thank you Stylianos, I needed this confirmation 😄
🤗 1
s
I've done this exact same thing once for a "floating chat bubble" feature I built. Where you could access the chat either from the screen itself or from the bubble. So it was the exact same idea. I just extracted the code in this exact same manner and it worked perfectly fine
thank you color 1