title: No MediaQuery widget ancestor found
body: <pre><code>import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  import 'info.dart';
  
  void main() =&gt; runApp(MyApp());
  
  class MyApp extends StatefulWidget {
    @override
    State&lt;StatefulWidget&gt; createState() =&gt; MyAppState();
  }
  
  class MyAppState extends State&lt;MyApp&gt; {
    List&lt;info&gt; li = [
      info(name: 'text1', length: 170, date: DateTime.now()),
      info(name: 'text2', length: 175, date: DateTime.now()),
      info(name: 'text3', length: 180, date: DateTime.now()),
      info(name: 'text4', length: 180, date: DateTime.now()),
      info(name: 'text5', length: 180, date: DateTime.now()),
      info(name: 'text6', length: 180, date: DateTime.now()),
      info(name: 'text7', length: 180, date: DateTime.now()),
      info(name: 'text8', length: 180, date: DateTime.now()),
      info(name: 'text9', length: 180, date: DateTime.now()),
    ];
  
    void x (BuildContext ctx){
      showModalBottomSheet(context: ctx, builder: (ctx){
        return ListView.builder(
          itemCount: li.length,
          itemBuilder: (cx , index){
            return Padding(
              padding: EdgeInsets.all(10.0),
              child: Card(
                shadowColor: Colors.red,
                elevation: 10.0,
                color: Colors.blue,
  
                child: Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: Column(
                    children: &lt;Widget&gt;[
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: &lt;Widget&gt;[
                          Text(
                            li[index].name,
                            style: TextStyle(color: Colors.white, fontSize: 20),
                          ),
                          Text(
                            '${li[index].length}',
                            style: TextStyle(color: Colors.white, fontSize: 20),
                          ),
                        ],
                      ),
                      Text(
                        '${li[index].date}',
                        style: TextStyle(color: Colors.white, fontSize: 20),
                      ),
                    ],
                  ),
                ),
              ),
            );
          },
        );
      });
    }
  
  
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'App name',
        home: Scaffold(
          appBar: AppBar(
            title: Text('This is the App bar'),
          ),
          body: Container(
            padding: EdgeInsets.all(10.0),
            height: double.infinity,
            color: Colors.black,
          ),
          floatingActionButton: FloatingActionButton(
            child: Icon(Icons.add),
            onPressed: () =&gt; x(context)
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>Error:</p>
  <blockquote>
  <p>The following assertion was thrown while handling a gesture: No
  MediaQuery widget ancestor found.</p>
  <p>MyApp widgets require a MediaQuery widget ancestor. The specific
  widget that could not find a MediaQuery ancestor was: MyApp   state:
  MyAppState#7e07c The ownership chain for the affected widget is:
  &quot;MyApp ← [root]&quot;</p>
  <p><strong>No MediaQuery ancestor could be</strong> found starting from the context that was passed to MediaQuery.of(). This can happen because you have
  not added a WidgetsApp, CupertinoApp, or MaterialApp widget (those
  widgets introduce a MediaQuery), or it can happen if the context you
  use comes from a widget above those widgets.</p>
  </blockquote>
  <p>What is wrong in my code? I have already used scaffold and MaterialApp Widgets and the instructor didn't use MediaQuery and I even don't know what that means, but it worked for him!</p>