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
petrovWF edited this page Jun 16, 2021
·
4 revisions
App
is stateful widget which is the entry point of the application.
Before calling the build method pre app configuration is executed, also after the build method post app configuration will be executed. For more information about pre and post app configurations please check:
- Activates AppLifecycleObserver
- Initializes AppRouterDelegate
- Initializes LocalizationNotifier
- Calls post app configuration (except in production)
- Adds ‘debugOverlay’ (except in production)
- Sets preferred orientations
- Return multi provider with the folowing 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
,MK
] - home: Router instance with:
- routerDelegate:
_appRouterDelegate
- backButtonDispatcher: RootBackButtonDispatcher instance
- routerDelegate:
- Deactivates AppLifecycleObserver