What is the Difference Between Scaffold and MaterialApp In Flutter?
MaterialApp Widget is a predefined class in a flutter. It is likely the main or core component of flutter. we can access all the other components and widgets provided by Flutter SDK So In this article, we will go through What is the Difference Between Scaffold and MaterialApp In Flutter?
What is the Difference Between Scaffold and MaterialApp In Flutter?
MaterialApp Widget is the starting point of your app, it tells Flutter that you are going to use Material components and follow the material design in your app.
MaterialApp is a widget that introduces a number of widgets Navigator, Theme that are required to build a material design app.
Scaffold Widget is used under MaterialApp, it gives you many basic functionalities, like AppBar, BottomNavigationBar, Drawer, FloatingActionButton, etc.
The Scaffold is designed to be the single top-level container for a MaterialApp although it is not necessary to nest a Scaffold.
Also, check out the official Flutter Doc for MaterialApp and Scaffold.
So, this is how a typical app starts with.
void main() { runApp(MaterialApp( home: Scaffold( appBar: AppBar(), body: YourWidget(), ), )); }
Conclusion:
Thanks for being with us on a Flutter Journey !!!
In this article, We have been through What is the Difference Between Scaffold and MaterialApp In Flutter?
Keep Learning !!! Keep Fluttering !!!
FlutterAgency.com is one of the most popular online portal dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge on Flutter.