I can't find a right way to use dialogs in compose. For example I have a common bottom sheet dialog with options list. I created an OptionsDialog
widget, OptionsDialogState
(list of options like: title, icon and etc) and rememberSaveable
function for this state. Created LocalOptionDialogSate
with compositionLocalOf
. I placed OptionsDialog
in the root of my UI tree. Now I can easily call this dialog with custom options anywhere in my app via LocalOptionDialogSate
. But I steel need to pass action lambda for each option. And there is a problem. I can't save/restore (rememberSaveable
) state with function properties. How do I need to pass actions block (like () -> Unit
) to the dialog?
Asked
Active
Viewed 77 times
1

Vadim Zhukov
- 95
- 6
-
Can you provide sample code – Sri mani789 Apr 14 '23 at 04:49