Reputation: 91
Can anyone please tell me what are the differences between WidgetsApp class, MaterialApp class and Directionality class?. Can I say WidgetsApp is inherited from Directionality? because both of them I can use them for layout non material apps.
Upvotes: 8
Views: 5262
Reputation: 315
WidgetsApp class is actually the base class for MaterialApp class and the CupertionApp class. Whereas Directionality is actually a class which provides the default direction for the text in sub-tree in the app. MaterialApp contains WidgetsApp class and Directionality class (so there is always a default direction for Text widget ), and custom transitions, and many other modifications/additions as per material specification in your app (Which is probably the error which brought you to asking this question). Hope this helps.
Upvotes: 2
Reputation: 7915
MaterialApp builds upon a WidgetsApp by adding material-design specific functionality.
As stated in the official Flutter documentation:
A convenience widget that wraps a number of 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.
A convenience class that wraps a number of widgets that are commonly required for an application.
One of the primary roles that WidgetsApp provides is binding the system back button to popping the Navigator or quitting the application.
Upvotes: 8