This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
app.dart
Dimitar Zabaznoski edited this page Jun 16, 2021
·
4 revisions
App
is the entry widget of the app. It's a stateful widget that builds MaterialApp.
Before the build method, the pre-app configuration is executed, also after the build method, the post-app configuration will be executed. For more information about pre and post app configurations please check the configuration docs.
- Activates
AppLifecycleObserver
- Initializes
AppRouterDelegate
- Initializes
LocalizationNotifier
When the build
method finishes:
- Calls post app configuration
- Adds ‘debugOverlay’ (except in production)
- Sets preferred orientations
- Return multi provider with the following providers:
ThemeChangeNotifier
LocalizationNotifier
AppRouterDelegate
Consumer2 will be the child of the MultiProvider and provides observers for:
- LocalizationNotifier:
localeObject
which provides locale changes on the fly - ThemeChangeNotifier:
themeObject
which provides theme changes on the fly
MaterialApp is returned from Consumer2 with the following configuration:
- theme:
themeLight()
- darkTheme:
themeDark()
- themeMode:
themeObject.getThemeMode
- localizationDelegates:
- AppLocalizations delegate
- GlobalMaterialLocalizations delegate
- GlobalWidgetsLocalizations delegate
- GlobalCupertinoLocalizations delegate
- locale:
localeObject.locale
- supportedLocales:
EN
andMK
- home: Router instance with:
- routerDelegate:
_appRouterDelegate
- backButtonDispatcher: RootBackButtonDispatcher instance
- routerDelegate:
- Deactivates AppLifecycleObserver