MasamuneApp constructor

const MasamuneApp({
  1. Key? key,
  2. AppRef? appRef,
  3. AuthAdapter? authAdapter,
  4. StorageAdapter? storageAdapter,
  5. FunctionsAdapter? functionsAdapter,
  6. List<LoggerAdapter> loggerAdapters = const [],
  7. AppThemeData? theme,
  8. AppLocalizeBase? localize,
  9. RouterConfig<Object>? routerConfig,
  10. ModelAdapter? modelAdapter = const RuntimeModelAdapter(),
  11. bool debugShowCheckedModeBanner = true,
  12. bool showPerformanceOverlay = false,
  13. String title = "",
  14. ThemeMode? themeMode = ThemeMode.system,
  15. Map<String, Widget Function(BuildContext)> routes = const <String, WidgetBuilder>{},
  16. List<NavigatorObserver> navigatorObservers = const <NavigatorObserver>[],
  17. GlobalKey<ScaffoldMessengerState>? scaffoldMessengerKey,
  18. String onGenerateTitle(
    1. BuildContext
    )?,
  19. Widget? home,
  20. String? initialRoute,
  21. Route? onGenerateRoute(
    1. RouteSettings routeSettings
    )?,
  22. List<Route> onGenerateInitialRoutes(
    1. String routePath
    )?,
  23. Route? onUnknownRoute(
    1. RouteSettings routeSettings
    )?,
  24. Widget builder(
    1. BuildContext context,
    2. Widget? child
    )?,
  25. List<Widget Function(BuildContext context, Widget app)>? onBuildAppFilters,
  26. List<MasamuneAdapter> masamuneAdapters = const <MasamuneAdapter>[],
  27. List<LocalizationsDelegate>? localizationsDelegates,
  28. List<Locale>? supportedLocales,
})

MaterialApp for Masamune Framework.

It encapsulates the XXScope widget used in a series of katana packages. In addition, XXXScope can be specified by adding onBuildAppFilters.

You can pass the AppRef used in katana_scoped in appRef.

You can pass AppThemeData used in katana_theme in theme. You can also specify ThemeMode in themeMode.

You can pass AppLocalizeBase used by katana_localize in localize.

Other adapters for data and authentication such as modelAdapter and authAdapter can be passed.

It is also possible to install additional plug-in adapters for the Masamune Framework in masamuneAdapters.

You can pass the AppRouter used by katana_router in routerConfig.

If you do not pass routerConfig, you can also use Flutter"s native routing functionality as you normally would with MaterialApp, using routes, initialRoute, onGenerateRoute, onGenerateInitialRoutes, onUnknownRoute , builder, navigatorObservers, and scaffoldMessengerKey to take advantage of Flutter"s native routing capabilities.

You can also use home to display a single widget. (available in Example, for example).

The application title can be set with title and onGenerateTitle.

The debug banner can be displayed with debugShowCheckedModeBanner and the performance overlay can be displayed with showPerformanceOverlay.

Masamune Framework用のMaterialApp

一連のkatanaのパッケージで利用されているXXScopeのウィジェットを内包しています。さらにonBuildAppFiltersを追加することでXXXScopeを指定することも可能です。

appRefkatana_scopedで使われているAppRefを渡すことができます。

themekatana_themeで使われているAppThemeDataを渡すことができます。また、themeModeThemeModeをあわせて指定できます。

localizekatana_localizeで利用されているAppLocalizeBaseを渡すことができます。

その他、modelAdapterauthAdapterといったデータや認証用のアダプターを渡すことが可能です。 また、masamuneAdaptersでMasamune Frameworkの追加プラグインアダプターを導入することが可能です。

routerConfigkatana_routerで使われているAppRouterを渡すことができます。

routerConfigを渡さなかった場合、通常のMaterialAppと同じ様にroutesinitialRouteonGenerateRouteonGenerateInitialRoutesonUnknownRoutebuildernavigatorObserversscaffoldMessengerKeyを用いてFlutterネイティブのルーティング機能を利用することも可能です。

また、homeを用いて単一のウィジェットを表示することができます。(Exampleなどで利用可能です)

titleonGenerateTitleでアプリタイトルを設定することが可能です。

debugShowCheckedModeBannerでデバッグ用のバナーを表示することができ、showPerformanceOverlayでパフォーマンスのオーバーレイを表示することができます。

Implementation

const MasamuneApp({
  super.key,
  this.appRef,
  this.authAdapter,
  this.storageAdapter,
  this.functionsAdapter,
  this.loggerAdapters = const [],
  this.theme,
  this.localize,
  this.routerConfig,
  this.modelAdapter = const RuntimeModelAdapter(),
  this.debugShowCheckedModeBanner = true,
  this.showPerformanceOverlay = false,
  this.title = "",
  this.themeMode = ThemeMode.system,
  this.routes = const <String, WidgetBuilder>{},
  this.navigatorObservers = const <NavigatorObserver>[],
  this.scaffoldMessengerKey,
  this.onGenerateTitle,
  this.home,
  this.initialRoute,
  this.onGenerateRoute,
  this.onGenerateInitialRoutes,
  this.onUnknownRoute,
  this.builder,
  this.onBuildAppFilters,
  this.masamuneAdapters = const <MasamuneAdapter>[],
  this.localizationsDelegates,
  this.supportedLocales,
});