I'm using AlertDialog.adaptive, but I can't change the background color of the dialog displayed on IOS

112 Views Asked by At

I am using AlertDialog.adaptive, but in Android, if you specify the background color with backgroundColor, it will be reflected in the background color.

However, on IOS, even if you specify a color with backgroundColor, it is not reflected. How can I specify the background color of AlertDialog.adaptive even on IOS?

1

There are 1 best solutions below

0
Midhun MP On

No, it's not possible to do that with AlertDialog.adaptive. In iOS this will create a CupertinoAlertDialog which won't use the provided background colour. You can read the documentation to know more details about this behaviour.

The possible solutions are either you create your own widget which will mimic the dialog behaviour or use any third-party libraries (like material_dialogs)