Home > Net >  How to use material3 custom dialog in jetpack compose
How to use material3 custom dialog in jetpack compose

Time:02-03

I want to build Alert Dialog with options selection with rounded corners. I tried Material 3 library Alert Dialog code. I was looking this enter image description here

Expected Output

enter image description here

CodePudding user response:

The BOM package contains only stable versions of the different Compose libraries. In particular the BOM 2022.11.00 contains the androidx.compose.material3:material3:1.0.1

To use the content parameter with AlertDialog you have to use at least the version 1.1.0-alpha04 of M3.

In your build.gradle use:

dependencies {
    // Import the Compose BOM
    implementation platform('androidx.compose:compose-bom:2023.01.00')

    // Override Material Design 3 library version with a pre-release version
    implementation 'androidx.compose.material3:material3:1.1.0-alpha05'

   //...
}

Also check the BOM to libraries mapping.

  • Related