title: Display SnackBar on top of AlertDialog widget
body: <p>I have an <code>AlertDialog</code> widget that will cause a SnackBar to display when you tap on its Text. The SnackBar currently displays behind the <code>AlertDialog</code> barrier, in the background. I want the Snackbar to display on top of the transparent <code>AlertDialog</code> barrier instead. Is the behavior that I'm seeking possible to achieve in Flutter? I have created a brand new Flutter app and included only the relevant code to illustrate the use-case below, as well as a screenshot.</p>
  <p><a href="https://gist.github.com/joshykautz/e7e6831e7d7c89f46bfb7ab1e1f8a129" rel="noreferrer"><strong>Main.dart</strong></a> <strong>Gist</strong></p>
  <pre class="lang-dart prettyprint-override"><code>@override
  Widget build(BuildContext context) {
    WidgetsBinding.instance!.addPostFrameCallback((_) async {
      showDialog(
        context: context,
        builder: (BuildContext dialogContext) =&gt; AlertDialog(
          content: GestureDetector(
            onTap: () {
              ScaffoldMessenger.of(dialogContext).showSnackBar(SnackBar(
                content: const Text('snack'),
                duration: const Duration(seconds: 1),
                action: SnackBarAction(
                  label: 'ACTION',
                  onPressed: () {},
                ),
              ));
            },
            child: Center(
              child: Text('Show SnackBar!'),
            ),
          ),
        ),
      );
    });
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Invoke &quot;debug painting&quot; (press &quot;p&quot; in the console, choose the
          // &quot;Toggle Debug Paint&quot; action from the Flutter Inspector in Android
          // Studio, or the &quot;Toggle Debug Paint&quot; command in Visual Studio Code)
          // to see the wireframe for each widget.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: &lt;Widget&gt;[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/27TIRm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/27TIRm.png" alt="enter image description here" /></a></p>