ArcaneApp constructor
const
ArcaneApp({
- Key? key,
- ArcaneTheme? theme,
- Widget? home,
- Map<
String, WidgetBuilder> routes = const <String, WidgetBuilder>{}, - String initialRoute = "/",
- RouteFactory? onGenerateRoute,
- InitialRouteListFactory? onGenerateInitialRoutes,
- RouteFactory? onUnknownRoute,
- TransitionBuilder? builder,
- String title = '',
- GenerateAppTitle? onGenerateTitle,
- Color? color,
- Locale? locale,
- Iterable<
LocalizationsDelegate> ? localizationsDelegates, - LocaleListResolutionCallback? localeListResolutionCallback,
- LocaleResolutionCallback? localeResolutionCallback,
- Iterable<
Locale> supportedLocales = const <Locale>[Locale('en', 'US')], - bool debugShowMaterialGrid = false,
- bool showPerformanceOverlay = false,
- bool showSemanticsDebugger = false,
- bool debugShowCheckedModeBanner = false,
- Map<
ShortcutActivator, Intent> ? shortcuts, - Map<
Type, Action< ? actions,Intent> > - String? restorationScopeId,
- AdaptiveScaling? scaling,
- bool disableBrowserContextMenu = true,
Creates an ArcaneApp with standard navigation using Flutter's Navigator system.
This constructor configures the app for imperative routing, where routes are defined via
maps or factories. It initializes the Navigator with the provided key, home widget,
and route builders, integrating ArcaneTheme for consistent styling. Ideal for simple
apps using push/pop navigation with components like BottomNavigationBar or Sidebar
.
Parameters:
- key: Standard Flutter widget key for identification and state management.
- theme: Optional ArcaneTheme to apply app-wide styling; defaults to a basic theme if null.
- navigatorKey: GlobalKey<NavigatorState> for direct navigator access (e.g., for programmatic pushes).
- home: Root Widget displayed at the initial route ("/"); often an
AbstractScreen
or NavigationScreen. - routes: Map of route names to WidgetBuilders for predefined paths; merges with defaults for Arcane routes.
- initialRoute: Starting route path; defaults to "/" for the home widget.
- onGenerateRoute: Callback to dynamically build routes based on RouteSettings; supports complex logic.
- onGenerateInitialRoutes: Factory for initial route list; rarely used but allows custom startup flows.
- onUnknownRoute: Fallback route generator for unmatched paths; ensures graceful error handling.
- onNavigationNotification: Listener for NavigationNotification events, e.g., to track route changes.
- navigatorObservers: List of NavigatorObservers for logging or analytics on navigation events.
- builder: TransitionBuilder to wrap the navigator output, e.g., for global theming or providers.
- title: App title for system bars and accessibility; used in GenerateAppTitle if provided.
- onGenerateTitle: Dynamic title generator based on BuildContext; overrides static title.
- color: Primary Color for system UI (e.g., status bar); integrates with ArcaneTheme.
- locale: Initial app Locale; affects Localizations and right-to-left layouts.
- localizationsDelegates: Iterable of LocalizationsDelegates for i18n support; enables Localizations.
- localeListResolutionCallback: Resolves conflicting locales from device and app lists.
- localeResolutionCallback: Selects the best Locale from supported ones based on device settings.
- supportedLocales: List of Locales the app handles; defaults to English (US) for broad compatibility.
- debugShowMaterialGrid: Toggles Material Design grid overlay for layout debugging.
- showPerformanceOverlay: Enables performance metrics overlay to monitor frame rates and rebuilds.
- showSemanticsDebugger: Shows semantic tree for accessibility testing.
- debugShowCheckedModeBanner: Displays "DEBUG" banner in debug mode; defaults to false for production-like testing.
- shortcuts: Map of ShortcutActivator to Intent for keyboard navigation support.
- actions: Map of Intent types to Actions for handling user inputs.
- restorationScopeId: ID for state restoration across app restarts (e.g., for
Hive
integration). - scaling: Optional AdaptiveScaling for responsive UI adjustments across devices.
- disableBrowserContextMenu: Prevents web context menu for native app feel; defaults to true.
Returns: A configured ArcaneApp ready for standard navigation, emphasizing efficient route caching and theme propagation to child components like Sheet or SliverScreen without redundant rebuilds.
Implementation
const ArcaneApp({
super.key,
this.theme,
this.navigatorKey,
this.home,
Map<String, WidgetBuilder> this.routes = const <String, WidgetBuilder>{},
this.initialRoute = "/",
this.onGenerateRoute,
this.onGenerateInitialRoutes,
this.onUnknownRoute,
this.onNavigationNotification,
List<NavigatorObserver> this.navigatorObservers =
const <NavigatorObserver>[],
this.builder,
this.title = '',
this.onGenerateTitle,
this.color,
this.locale,
this.localizationsDelegates,
this.localeListResolutionCallback,
this.localeResolutionCallback,
this.supportedLocales = const <Locale>[Locale('en', 'US')],
this.debugShowMaterialGrid = false,
this.showPerformanceOverlay = false,
this.showSemanticsDebugger = false,
this.debugShowCheckedModeBanner = false,
this.shortcuts,
this.actions,
this.restorationScopeId,
this.scaling,
this.disableBrowserContextMenu = true,
}) : routeInformationProvider = null,
routeInformationParser = null,
routerDelegate = null,
backButtonDispatcher = null,
routerConfig = null;