What is the difference between Material and MaterialApp in Flutter?

 MaterialApp is a widget that introduces many interesting tools such as Navigator or Theme to help you develop your app.

Material is, on the other hand, a widget used to define a UI element respecting Material rules. It defines what elevation is, shape, and stuff. Then reused by many material widgets such as Appbar or Card or FloatingButton.

In short, use both. You should have a MaterialApp near the root of your app. And then use widgets that introduce a Material instance (Such a ScaffoldAppbarDialog, ...) when you want to use Text or InkWell



MaterialApp : The MaterialApp configures the top-level Navigator to search for routes or to define Home.

Material : For child UI widgets rendering & effects.

No comments

Powered by Blogger.