{"id":855,"date":"2024-07-01T16:07:35","date_gmt":"2024-07-01T16:07:35","guid":{"rendered":"https:\/\/www.cmsgalaxy.com\/blog\/?p=855"},"modified":"2024-07-01T16:07:37","modified_gmt":"2024-07-01T16:07:37","slug":"materialapp-class-in-flutter","status":"publish","type":"post","link":"https:\/\/www.cmsgalaxy.com\/blog\/materialapp-class-in-flutter\/","title":{"rendered":"MaterialApp class in Flutter"},"content":{"rendered":"\n<p>The <code>MaterialApp<\/code> class in Flutter is a widget that wraps several essential widgets and is the starting point for many Flutter applications. It provides material design visual structure and functionality, such as themes, routing, and localization. The <code>MaterialApp<\/code> widget is often used as the root of a Flutter app to set up the basic material design features.<\/p>\n\n\n\n<p><strong>Constructor of MaterialApp class<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const MaterialApp(\r\n{Key key,\r\nGlobalKey&lt;NavigatorState> navigatorKey,\r\nWidget home,\r\nMap&lt;String, WidgetBuilder> routes: const &lt;String, WidgetBuilder>{},\r\nString initialRoute,\r\nRouteFactory onGenerateRoute,\r\nInitialRouteListFactory onGenerateInitialRoutes,\r\nRouteFactory onUnknownRoute,\r\nList&lt;NavigatorObserver> navigatorObservers: const &lt;NavigatorObserver>&#91;],\r\nTransitionBuilder builder,\r\nString title: '',\r\nGenerateAppTitle onGenerateTitle,\r\nColor color,\r\nThemeData theme,\r\nThemeData darkTheme,\r\nThemeData highContrastTheme,\r\nThemeData highContrastDarkTheme,\r\nThemeMode themeMode: ThemeMode.system,\r\nLocale locale,\r\nIterable&lt;LocalizationsDelegate> localizationsDelegates,\r\nLocaleListResolutionCallback localeListResolutionCallback,\r\nLocaleResolutionCallback localeResolutionCallback,\r\nIterable&lt;Locale> supportedLocales: const &lt;Locale>&#91;Locale('en', 'US')],\r\nbool debugShowMaterialGrid: false,\r\nbool showPerformanceOverlay: false,\r\nbool checkerboardRasterCacheImages: false,\r\nbool checkerboardOffscreenLayers: false,\r\nbool showSemanticsDebugger: false,\r\nbool debugShowCheckedModeBanner: true,\r\nMap&lt;LogicalKeySet, Intent> shortcuts,\r\nMap&lt;Type, Action&lt;Intent>> actions}\r\n)<\/code><\/pre>\n\n\n\n<p><strong>Key Properties of MaterialApp :-<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>home<\/code><\/strong>: The default route of the app, usually a <code>Scaffold<\/code> widget.<\/li>\n\n\n\n<li><strong><code>routes<\/code><\/strong>: A map of route names to widget builder functions.<\/li>\n\n\n\n<li><strong><code>initialRoute<\/code><\/strong>: The name of the first route to show.<\/li>\n\n\n\n<li><strong><code>initialRoute<\/code><\/strong>: The name of the first route to show.<\/li>\n\n\n\n<li><strong><code>onUnknownRoute<\/code><\/strong>: A function that returns a route for unknown routes.<\/li>\n\n\n\n<li><strong><code>theme<\/code><\/strong>: The theme to use for the app.<\/li>\n\n\n\n<li><strong><code>darkTheme<\/code><\/strong>: The dark theme to use for the app.<\/li>\n\n\n\n<li><strong><code>themeMode<\/code><\/strong>: The mode to decide whether to use the light or dark theme.<\/li>\n\n\n\n<li><strong><code>locale<\/code><\/strong>: The locale for the app.<\/li>\n\n\n\n<li><strong><code>localizationsDelegates<\/code><\/strong>: A list of delegates for localization.<\/li>\n\n\n\n<li><strong><code>supportedLocales<\/code><\/strong>: A list of supported locales.<\/li>\n\n\n\n<li><strong><code>debugShowCheckedModeBanner<\/code><\/strong>: Whether to show the debug banner.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The MaterialApp class in Flutter is a widget that wraps several essential widgets and is the starting point for many<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-855","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts\/855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/comments?post=855"}],"version-history":[{"count":1,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts\/855\/revisions"}],"predecessor-version":[{"id":856,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts\/855\/revisions\/856"}],"wp:attachment":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/media?parent=855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/categories?post=855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/tags?post=855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}