ste
05/18/2021, 12:15 PMDrawer
. When button1
is clicked, the drawer pops up and shows content1
, when button2
is clicked, content2
is shown instead. And so on.
It makes no sense to create two (or n
) drawers, because their visibility is mutually exclusive: it makes more sense to have a single Drawer
, and then dynamically change its content. This also improve performance.
Actually, I store a key: String
using rememberSaveable
, and I retrieve the drawer content using that key. Then, when buttonN
is clicked, I change the key to "contentN"
, so the drawer pops up displaying contentN
.
This solution works, however, is there a more elegant way to achieve this?