Flutter & Dart · Component
MaterialApp
MaterialApp is the main Flutter widget for apps that use Material Design. It adds themes, navigation, localization, selection defaults, and other Material-specific behavior on top of WidgetsApp.
Last updated
Syntax
const MaterialApp({
Key? key,
GlobalKey<NavigatorState>? navigatorKey,
Widget? home,
Map<String, WidgetBuilder> routes = const <String, WidgetBuilder>{},
String? initialRoute,
RouteFactory? onGenerateRoute,
InitialRouteListFactory? onGenerateInitialRoutes,
RouteFactory? onUnknownRoute,
List<NavigatorObserver> navigatorObservers = const <NavigatorObserver>[],
TransitionBuilder? builder,
String? title = '',
GenerateAppTitle? onGenerateTitle,
Color? color,
ThemeData? theme,
ThemeData? darkTheme,
ThemeData? highContrastTheme,
ThemeData? highContrastDarkTheme,
ThemeMode themeMode = ThemeMode.system,
Duration themeAnimationDuration = kThemeAnimationDuration,
Curve themeAnimationCurve = Curves.linear,
Locale? locale,
Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates,
Iterable<Locale> supportedLocales = const <Locale>[Locale('en', 'US')],
bool debugShowCheckedModeBanner = true,
Map<ShortcutActivator, Intent>? shortcuts,
Map<Type, Action<Intent>>? actions,
String? restorationScopeId,
ScrollBehavior? scrollBehavior,
AnimationStyle? themeAnimationStyle,
})In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
ScaffoldNavigatorMaterialPageRouteWidgetsAppThemeDataDefaultSelectionStyleHeroControllerActions