title: Flutter Alert Dialog Not Centered
body: <p>I'm creating a Flutter mobile application. I have a Scaffold with a Drawer that is Centered in the App Like This:</p>
  <blockquote>
  <p>Centered Drawer: <a href="https://ibb.co/s5BMdNM" rel="nofollow noreferrer">https://ibb.co/s5BMdNM</a></p>
  </blockquote>
  <p>When The User Taps on the 2nd ListTile which is &quot;Filter Character / Choose Categories&quot;, an AlertDialog popups. The Problem is the Alert Dialog isn't Centered neither vertically nor horizontally in the Landscape Orientation, and It's not centered vertically in the Portrait one.</p>
  <blockquote>
  <p>Landscape AlertDialog: <a href="https://ibb.co/GtdJ2jZ" rel="nofollow noreferrer">https://ibb.co/GtdJ2jZ</a></p>
  <p>Portrait AlertDialog: <a href="https://ibb.co/HH6vQbx" rel="nofollow noreferrer">https://ibb.co/HH6vQbx</a></p>
  </blockquote>
  <p>I've tried calculating the percentage of the misplacement and adding it as a padding to the right, it worked when the Device Orientation was LandscapeRight, but was misplaced again when the orientation became LandscapeLeft.</p>
  <blockquote>
  <p>Right Adjusted: <a href="https://ibb.co/h9K0YB3" rel="nofollow noreferrer">https://ibb.co/h9K0YB3</a></p>
  <p>Left Misplaced: <a href="https://ibb.co/JykZ67x" rel="nofollow noreferrer">https://ibb.co/JykZ67x</a></p>
  </blockquote>
  <p>I've Searched but currently there's a problem getting the Device's true orientation.</p>
  <p>So can anyone help me centering the AlertDialog, or tell me why it isn't centered? Thanks in Advance.</p>
  <p>Summarized Drawer's Code:</p>
  <pre><code>Scaffold(
  key: scaffoldKey,
  backgroundColor: Colors.grey[100],
  body: _getScaffoldBody(homePageState, context),
  drawer: Center(
  child: Container(
    alignment: Alignment.center,
    width: MediaQuery.of(context).size.width * 0.9 &gt; 375
        ? 375
        : MediaQuery.of(context).size.width * 0.9,
    height: MediaQuery.of(context).size.height * 0.9 &gt; 58.0 * 6
        ? 58.0 * 6 // 58 * Number of List Tiles
        : MediaQuery.of(context).size.height * 0.9,
    decoration: new BoxDecoration(
      color: Colors.white,
      borderRadius: new BorderRadius.all(Radius.circular(5)),
    ),
    child: ListView(
      shrinkWrap: true,
      padding: EdgeInsets.zero,
      physics: BouncingScrollPhysics(),
      children: &lt;Widget&gt;[
        Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: &lt;Widget&gt;[
            ListTile(
              title: Text('Filter Characters / Choose Categories'),
              trailing: Icon(
                Icons.search,
                color: Colors.blue,
              ),
              onTap: () {
                showCategoriesDialg(homePageState, context);
              },
            ),
          ],
        ),
      ),
    ),
  ),
  </code></pre>
  <p>Showing AlertDialog's Code:</p>
  <pre><code>Future showCategoriesDialg(State&lt;HomePage&gt; homePageState, BuildContext context) async {
    return showDialog&lt;void&gt;(
      context: context,
      barrierDismissible: false, // user must tap a button!
      builder: (BuildContext context) {
        return AlertDialog(
          scrollable: true,
          content: Container(
            width: MediaQuery.of(context).size.width,
            height: MediaQuery.of(context).size.height - 200,
            child: ListView.builder(
              itemCount: categories.length,
              itemBuilder: (context, index) {
                return CheckboxListTile(
                  title: Text(categories.values.elementAt(index).titleEn),
                  value: categories.values.elementAt(index).checked,
                  onChanged: (newValue) {
                    homePageState.setState(() {
                      categories.values.elementAt(index).checked = newValue;
                    });
                  },
                  controlAffinity: ListTileControlAffinity.trailing,
                );
              },
            ),
          ),
        );
      },
    );
  }
  </code></pre>