Идея состоит в том, что этот GenericSettingWithDialog< /code> принимает на вход Composable, обрабатывающий содержимое диалога:
Код: Выделить всё
@Composable
fun GenericSettingWithDialog (
name: String,
state: State,
dialogContent: @Composable ()-> Unit
) {
var isDialogShown by remember {
mutableStateOf(false)
}
if (isDialogShown) {
Dialog(onDismissRequest = {
isDialogShown = false
}) {
dialogContent()
}
}
// setting row launching the dialog, with title and graphics
}
Подробнее здесь: https://stackoverflow.com/questions/786 ... -passed-as
Мобильная версия