KareeMaterialApp constructor
KareeMaterialApp({
- Key? key,
- required ApplicationKind kind,
- String? restorationScopeId,
- GlobalKey<
ScaffoldMessengerState> ? scaffoldMessengerKey, - String title = '',
- GenerateAppTitle? onGenerateTitle,
- Color? color,
- CupertinoThemeData? cupertinoTheme,
- ThemeData? theme,
- ThemeData? darkTheme,
- ThemeMode themeMode = ThemeMode.system,
- Locale? locale,
- LocaleListResolutionCallback? localeListResolutionCallback,
- LocaleResolutionCallback? localeResolutionCallback,
- Iterable<
Locale> supportedLocales = const <Locale>[], - bool debugShowMaterialGrid = false,
- bool showPerformanceOverlay = false,
- bool checkerboardRasterCacheImages = false,
- bool checkerboardOffscreenLayers = false,
- bool showSemanticsDebugger = false,
- bool debugShowCheckedModeBanner = true,
- Map<
LogicalKeySet, Intent> ? shortcuts, - KareeInstanceProfile profile = KareeInstanceProfile.development,
- Map<
Type, Action< ? actions,Intent> > - ThemeData? highContrastDarkTheme,
- ThemeData? highContrastTheme,
- required List<
Of> observables, - ErrorContactAddress? errorContactAddress,
Implementation
KareeMaterialApp(
{Key? key,
required this.kind,
this.restorationScopeId,
this.scaffoldMessengerKey,
this.navigatorObservers = const <NavigatorObserver>[],
this.title = '',
this.onGenerateTitle,
this.color,
this.cupertinoTheme,
this.theme,
this.darkTheme,
this.themeMode = ThemeMode.system,
this.locale,
this.localeListResolutionCallback,
this.localeResolutionCallback,
this.supportedLocales = const <Locale>[],
this.debugShowMaterialGrid = false,
this.showPerformanceOverlay = false,
this.checkerboardRasterCacheImages = false,
this.checkerboardOffscreenLayers = false,
this.showSemanticsDebugger = false,
this.debugShowCheckedModeBanner = true,
this.shortcuts,
this.profile = KareeInstanceProfile.development,
this.actions,
this.highContrastDarkTheme,
this.highContrastTheme,
required this.observables,
this.errorContactAddress}) {
assert(profile == KareeInstanceProfile.development ||
(profile == KareeInstanceProfile.production &&
errorContactAddress != null));
KareeMaterialApp.globalProfile = profile;
KareeMaterialApp.globalErrorContactAddress = errorContactAddress;
KareeInternationalization.init(locale, supportedLocales.toList())
.catchError((onError, st) {
var ex = onError as TranslationFileNotExists;
KareeRouter.goto(KareeConstants.kareeErrorPath, parameter: {
#title: ex.message,
#stack: st,
#env: [
'${ex.locale.languageCode}${ex.locale.countryCode == null ? '' : '_${ex.locale.countryCode!.toLowerCase()}'}.json',
],
#errorCode: KareeErrorCode.noTranslationFile
});
}, test: (exception) => exception is TranslationFileNotExists);
// uncomment for testing
// if (!Platform.environment.containsKey('FLUTTER_TEST')) {
ErrorWidget.builder = (FlutterErrorDetails detail) {
return KareeRouterErrorWidget(
detail.summary.name,
detail.stack,
KareeErrorCode.generalError,
detail.context!.getChildren().map((e) => e.name ?? '').toList());
};
// }
}