Home > Net >  how to change paddings in dialog window in jetpack compose?
how to change paddings in dialog window in jetpack compose?

Time:07-27

I need to write a composable function that, like a dialog window, will be displayed over the rest of the screen elements. I wrap the contents of my composable function in Dialog(). But there are paddings on all sides of the screen. How can they be removed?

screenshot of problem, red lines are paddings that need to be removed

I use dialog in my function something like this:

@Composable
fun MyFunction(){
  Dialog(onDismissRequest = { }) {
    //content
  }
}

CodePudding user response:

You can do this:

        @Composable
        fun MyFunction(){
        Dialog(onDismissRequest = { },
        properties = DialogProperties(usePlatformDefaultWidth = false)) {
        Box(modifier = Modifier.fillMaxSize()) {
        //content
      }
    }
  }
  • Related