Skip to content

Instantly share code, notes, and snippets.

@k0siara
Created March 29, 2023 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k0siara/8f7eff7f3011385ef557cd8007f90661 to your computer and use it in GitHub Desktop.
Save k0siara/8f7eff7f3011385ef557cd8007f90661 to your computer and use it in GitHub Desktop.
fun DialogFragment.dialogFragmentComposeView(
consumeWindowInsets: Boolean,
content: @Composable () -> Unit,
): View {
return DialogFragmentComposeView(
context = requireContext(),
dialogProvider = { dialog ?: Dialog(requireContext()) },
).apply {
consumeWindowInsets = consumeWindowInsets
layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
setViewCompositionStrategy(strategy = ViewCompositionStrategy.DisposeOnDetachedFromWindow)
setContent {
CustomComposeTheme(
darkTheme = false
) {
content()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment