Search code examples
androidflutterflutter-webflutter-alertdialog

How to get the width and height of AlertDialog - Flutter Web


I want to get the exact height and width of AlertDialog in flutter.


Solution

  • I can't understand what your purpose is, rather specifying a size getting it's measurement.

    Within the context of alert dialog you can place other components inside it, using the following. Using the following code you can get the measurements inside the UI component that you consider as context.

    alert_dialog_height=MediaQuery.of(context).size.height; alert_dialog_width=MediaQuery.of(context).size.width;

    if you need to place something in the middle height of alert dialog just use

    alert_dialog_height/2