I am trying to add confirmation dialog that has a callback. I've noticed that NavHost has a feature to add dialog to it, but with callback it seems messy as I'd have to return callback to the nested composable in different screen. Any good examples of confirmation dialog with compose?
f
Francesc
03/04/2022, 6:20 AM
You can pass data back using the backstack, this shows how to pass some info from one screen to the previous, you can use this principle if you don't want callbacks https://medium.com/p/2649459c5f98
k
K Merle
03/04/2022, 6:36 AM
Are there any cons of showing plain composable AlertDialog with a callback and just use condition to show or hide it?
f
Francesc
03/04/2022, 6:42 AM
Not that I can think of, though I wonder how that's going to work if you have process death
a
Adam Powell
03/04/2022, 2:08 PM
The dialog composables already work as you describe, put an
if
around one and you can manage whether it's present or not
🙌 1
i
Ian Lake
03/08/2022, 4:10 AM
Yep, we actually specifically call out that things that have the shape of a AlertDialog (like most confirmation dialogs) should just use