"MyApp widgets require a MediaQuery widget ancestor." Code Answer's

You're definitely familiar with the best coding language TypeScript that developers use to develop their projects and they get all their queries like "MyApp widgets require a MediaQuery widget ancestor." answered properly. Developers are finding an appropriate answer about MyApp widgets require a MediaQuery widget ancestor. related to the TypeScript coding language. By visiting this online portal developers get answers concerning TypeScript codes question like MyApp widgets require a MediaQuery widget ancestor.. Enter your desired code related query in the search bar and get every piece of information about TypeScript code related question on MyApp widgets require a MediaQuery widget ancestor.. 

MyApp widgets require a MediaQuery widget ancestor.

By Lokesh003Lokesh003 on Mar 01, 2021
Its because, the showModalBottomSheet tries to access the ancestor of type 
MaterialApp from the given context.

Use Builder widget to get new context with MaterialApp ancestor or Separate 
your MaterialAapp and Scaffold widgets into separate widgets.

Using Builder :

floatingActionButton: Builder(
  builder: (context) => FloatingActionButton(
      child: Icon(Icons.add),
      onPressed: () { showModalBottomSheet(
          context: context,
          builder: (context) {
            return Text('Modal bottom sheet', style: TextStyle(fontSize: 30));
          });
      }
  ),
),
  
reference:
https://stackoverflow.com/questions/59864150/flutter-exception-caught-by-gesture-no-mediaquery-widget-found-inside-showmodal

Add Comment

1

All those coders who are working on the TypeScript based application and are stuck on MyApp widgets require a MediaQuery widget ancestor. can get a collection of related answers to their query. Programmers need to enter their query on MyApp widgets require a MediaQuery widget ancestor. related to TypeScript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about MyApp widgets require a MediaQuery widget ancestor. for the programmers working on TypeScript code while coding their module. Coders are also allowed to rectify already present answers of MyApp widgets require a MediaQuery widget ancestor. while working on the TypeScript language code. Developers can add up suggestions if they deem fit any other answer relating to "MyApp widgets require a MediaQuery widget ancestor.". Visit this developer's friendly online web community, CodeProZone, and get your queries like MyApp widgets require a MediaQuery widget ancestor. resolved professionally and stay updated to the latest TypeScript updates. 

TypeScript answers related to "MyApp widgets require a MediaQuery widget ancestor."

View All TypeScript queries

TypeScript queries related to "MyApp widgets require a MediaQuery widget ancestor."

Browse Other Code Languages

CodeProZone