Flutter Widgets → Flutter MaterialApp – Camposha

Flutter Widgets

Flutter Widgets

Flutter Widgets

Flutter MaterialApp

In flutter MaterialApp is a class that represents an application that uses material design.

It is a concrete class and derives from the StatefulWidget and resides in the flutter package.

class MaterialApp extends StatefulWidget

MaterialApp makes our job easier by wrapping several widgets that are commonly required for material design applications. It builds upon a WidgetsApp by adding material-design specific functionality, such as AnimatedTheme and GridPaper.

It then configures the top-level Navigator to search for routes in the following order:

  1. For the / route, the home property, if non-null, is used.
  2. Otherwise, the routes table is used, if it has an entry for the route.
  3. Otherwise, onGenerateRoute is called, if provided. It should return a non-null value for any valid route not handled by home and routes.
  4. Finally if all else fails onUnknownRoute is called.

If a Navigator is created, at least one of these options must handle the / route, since it is used when an invalid initialRoute is specified on startup (e.g. by another application launching this one with an intent on Android).

`MaterialApp also configures the observer of the top-level Navigator (if any) to perform Hero animations.

Examples coming soon.

Leave a Reply

Your email address will not be published. Required fields are marked *

X