Как убить все composables и оставить только голый activity?

Single-activity приложение. Часть фрагментов переделываю в Composables. Нужно, чтобы когда showFragments: stateFlow<Boolean> эмитит true, убивались все компоузаблы и я мог снова показывать фрагменты внутри navHostFragment.

Как убрать с активити все composables?


    this.lifecycleScope.launchWhenStarted {
            vmMain.showFragments.collectLatest {
                if (it) {
                    // todo destroy all composables
                    binding.navHostFragment.visibility = View.VISIBLE
                } else {
                    binding.navHostFragment.visibility = View.GONE
                    setContent {
                        PorosenokPetrTheme {
                            Surface(
                                color = MaterialTheme.colors.background
                            ) { // итд


Ответы (0 шт):